Automated User Acceptance Testing of Web Applications With Selenium
Automated User Acceptance Testing of Web Applications With Selenium
Overview
General Definitions Problem Statement Solutions Proposal Why Selenium? What is Selenium? Demo Whats next? References
General Definitions
User Acceptance Testing
Final testing based on
Specifications of the end-users or customer Use by end-users or customer over some limited period of time
1/3
Completed system vs. requirements Verification testing Validation testing Audit testing Performed by users of the system
General Definitions
Test Automation
Use of software to control the execution of tests Comparison of actual outcomes to predicted outcomes Setting up
Test preconditions Test control and reporting functions
2/3
General Definitions
Web Application
Application that is accessed over a network Client-server architecture
3/3
Problem Statement
User acceptance testing of web applications is
Costly
Browser (client) compatibility Web applications tend to get updated frequently Many possible inputs
Slow
Tied to browser performance Clients and servers communicate over network
Solution
Automating user acceptance tests
Usage of proprietary software Many tools exist
FitNesse HtmlUnit HttpUnit Watir, Vapir, Watij, WatiN, Win32-Watir, Watir for Rails Celerity iMacros Canoo WebTest Selenium
Why Selenium?
Handles JavaScript well
Other tools are not reliable in handling in-page JavaScript
What is Selenium?
Automated acceptance testing tool Developed by ThoughtWorks, now open source
1/10
Portable Deploys on Windows, Linux and MacOSX Supports various programming languages including C#, Java, Python, PHP, Perl, Ruby, Groovy Supports most modern web browsers including Firefox, Safari, Google Chrome, Opera, Internet Explorer Supports popular smart phones like Android and iPhone Tool suite Selenium 1 (a.k.a. Selenium RC or Remote Control) Selenium 2 (a.k.a. Selenium WebDriver) Selenium IDE Selenium Grid
10
What is Selenium?
Selenium 1 (a.k.a. Selenium RC or Remote Control)
Was the main Selenium project Still actively supported Supports several languages
Java, JavaScript, Ruby, PHP, Python, Perl, C#
2/10
Client libraries
Provide interface between any programming language and the Selenium Server
11
What is Selenium?
Selenium 1 (a.k.a. Selenium RC or Remote Control)
Architecture
3/10
12
What is Selenium?
Example for Selenium 1 (a.k.a. Selenium RC or Remote Control)
4/10
2- Run the language specific tests using the corresponding client API
13
What is Selenium?
Selenium 2 (a.k.a. Selenium WebDriver)
Provides a simple, concise programming interface Better supports dynamic web pages (AJAX) Supplies a well-designed object-oriented API
5/10
Makes direct calls to the browser using browsers native support for
14
What is Selenium?
Example for Selenium 2 (a.k.a. Selenium WebDriver)
6/10
15
What is Selenium?
Selenium IDE
Tool to develop Selenium test cases Uses Selenese (Selenium script language) Firefox plug-in Allows saving macros (like Microsoft Office macros)
7/10
Allows exporting saved test cases to any desired language that uses
16
What is Selenium?
Example for Selenium IDE
8/10
17
What is Selenium?
Selenium Grid
Builds on the traditional Selenium setup
More than one machine can be used
9/10
Selenium RC and the browser are not tied to a specific application (they can
Scalable
Selenium Hub
Allocates a Selenium RC to a specific test (transparently) Limits the number of concurrent test runs on each RC Shields the tests from the actual grid infrastructure
18
What is Selenium?
Selenium Grid Setup
10/10
19
Demo
Live demo
Bingo! Java Web Application Very simple test cases Selenium WebDriver is used Implementation is made in Python 2.7
20
Whats next?
Writing good tests
Keep tests self-contained Write own extensions if needed Write tests before development (TDD) Refactor tests (if possible)
Continuous Integration
Running selenium tests is possible (in-memory X window system) Test coverage analysis
21
References
Selenium Documentation (Release 1.0) / May 10, 2012
<URL: http://seleniumhq.org/docs/book/Selenium_Documentation.pdf>
Engineering (MySEC), 2011 5th Malaysian Conference in Digital Object Identifier: 10.1109/MySEC.2011.6140672.