Data driven automation testing of web applications using selenium
-
Upload
anandseelan -
Category
Technology
-
view
10.273 -
download
5
description
Transcript of Data driven automation testing of web applications using selenium
1AVACORP © 2011
Data Driven Automation Testing of Web Application using Selenium
Navaraj Javvaji
Anand Sathiyaseelan
Umamaheswari Selvan
2AVACORP © 2011
Lot of options, which one to choose?
Decision making is the crucial part while choosing the automation tool:
• High investment on commercial tools v/s Zero cost Open Source tools
• Ease of use v/s customization needs
• Better feature set v/s very limited feature set
AbbotAutoHotk
ey
CubicTest
Dogtail
Fitness
Selenium
SWTBot
WATIRWatiN
eggPlant QTPSilkTest
RFT
Test Partner
RIATest
SOATest
3AVACORP © 2011
First step should be towards identifying key expectations
Considerations for an Automation tool:
What should my Automation tool support?
Consistent and Diagrammatic Reporting Mechanism:
Logger Files
Analytic Test Report
Different Report Formats ( html, xml etc)
Ability to support enterprise wise reusable test automation suites
Reusable functions, exception handling mechanism etc
Ability to schedule tests
Ability to prioritize and run tests
Build verification tests, smoke tests, full regression tests, partial regression tests etc
Ability to report failures
Module wise failures, test step failures etc
Snapshots / screen shots of failed tests
4AVACORP © 2011
Let us understand this by considering SELENIUM as an ex
Before going into details, let us look at a quick preview from the technology perspective
JAVA
Java is a Object-Oriented programming language.
Created in 1991 by James Gosling et al. of Sun Microsystems.
It is a platform independent language.
It is robust, distributed, portable and Dynamic.
Automatic Memory Management and Security.
SELENIUM
Developed by Jason Huggins and released in 2004.
It is an open source Tool for automating web Application.
Selenium IDE is a Record and Playback tool which comes as a Firefox Plug-in .
Selenium RC is a server /solution for executing linear / regression / integration tests.
RC obtains the commands from the selenium server and run the tests via the browser.
It supports IE on Windows, Firefox & Opera on Windows, Mac and Linux, Safari on Windows, Mac
5AVACORP © 2011
Understanding Test Automation Frameworks
Definition
As defined by Wikipedia ** “Test Automation Framework”
Is a set of assumptions, concepts and tools that provide support for automated software testing
Helps reduce costs and maintenance time
Primarily driven by keeping extensive reusability in mind
Should be flexible enough to incorporate change yet robust enough to resist unwanted changes
Commonly Known Automation Frameworks
Test Script Modularity
Test Library Architecture
Data Driven
Keyword Driven or Table Driven
Hybrid Test Automation
Model Driven
** http://en.wikipedia.org/wiki/Test_automation_framework
6AVACORP © 2011
Fundamentals of Data Driven Framework
Data Driven Framework
Data driven testing is creation of test scripts to run together with their related data sets in the
framework.
Data driven scripts are those application-specific scripts captured or manually coded in the
automation tool’s proprietary language and then modified to accommodate variable data.
Its main advantage is the reusability and also the maintenance of these tests is easy. This requires
the preparation of the data sheets which is completely independent of the test automation tool.
Advantages:
Large amount of data can be fetched using the data sheet for repeated use of test case execution.
Reusability and maintenance.
Only the script representing a “Business Function” needs to be modified/updated in case if the functionality of the application under test (AUT) changes.
7AVACORP © 2011
Components of Selenium based Automation Framework
There might be minor differences between each organization’s framework, however what is listed are the key components of the framework
8AVACORP © 2011
Understanding Test Automation Framework components
ANT Script
A Script that is used to execute a set of instructions using build.xml.
It is used to run single test or batch test.
Test Scripts
The test scripts are the .java files which represents the test cases of the AUT.
Reusable Library
Reusable library consists of the common functions that can be reused.
Reusable library consist of those functions that are application independent and can be called to
perform certain tasks.
Can also be a collection of utilities that
Delivers capabilities to create detailed drill down reports in different formats
Helps generate a log of events that happen as part of automation test execution
Takes snapshot of failed tests
Careful observation reveals that Reusable Library can be a good source that can help extend Selenium capabilities
9AVACORP © 2011
Understanding Test Automation Framework components ..
Test Suite
Test suite is set up to cover execution of the specified test case name and the priority of the
execution takes place contiguously.
The final Test suite is run in two modes using the ANT Script:
run-single-test
run-batch-test
customized test suites for regression testing
10AVACORP © 2011
Understanding Test Automation Framework components ..
Test Reports
The test report is generated by ANT at the end of the test execution in different formats( .xml, HTML
etc).
The report also provides a time stamp that helps team manage versions of test reports.
Finally a consolidated status for the group of test steps that get executed gets presented via the
“Status”.
11AVACORP © 2011
Understanding Test Automation Framework components ..
Failed Test Screen Snapshot
Reusable functions are called by the test scripts to take an automatic snap shot of tests that have
failed.
Also adding a time stamp to the snapshot it will be easy for test teams to not only identify the exact
cause of failure but also provide evidence of failure in case it is needed.
Such features are easy to integrate using JAVA to capture and save a snapshot when a failure occurs
12AVACORP © 2011
Generate Custom Log Files
Logger is mainly designed to help the user to view the step by step execution of the test scripts
along with the time stamp, execution status whether it passed or failed.
Understanding Test Automation Framework components ..
Offer facility to choose between detailed log or events or a crisp summary of the key failures.
13AVACORP © 2011
Do’s and Don’ts
Do’s
As part of you automation journey, ensure the team is first trained on java & selenium syntax.
Before finalizing your framework, understand your needs and then design components that help you
meet your needs
Ensure the relation between the application test scripts and the framework is kept to the minimum.
Thus you can design a reusable and truly scalable framework
Create the keyword library and keep updating it with more keywords
Unless it is application specific, most of the test data can be reused
Use open source tools (like Snapit) to take screen shots
Use different folders for reusable function, test scripts, logger files, test results and test data sheets
Identify object elements using Internet Explorer Development Toolbar. This is easier and provides
reliable object information
14AVACORP © 2011
Advantages
Advantages
The framework is very robust, maintainable and portable
Redundancy is eliminated by designing for reusability
Easy to debug considering log files and the failed test scenario snap shot
Non programmers develop scripts with minimum efforts
Open source tool results in almost zero cost
Test Cases/Suites could be executed in 5 different browsers (Firefox, IE, safari, Chrome, Opera)
and also on different OS platforms(Windows, Linux, Mac) by Selenium RC.
Selenium RC enables the automation testers to write test cases in 6 different programming
languages(dot net, java, perl, php, python, ruby).
Using Selenium RC, it is easy to use Conditional statements, iterations. User exception handling
mechanism.
Reporting, Logging the user actions could be added as a feature under the continuous integration
system.
15AVACORP © 2011
Limitations
Limitations of Selenium IDE:
Selenium IDE is released as a plug-in/add-on only for Mozilla Firefox. Hence it is not compatible
with other web browsers.
Selenium IDE can execute scripts which were generated in the selenese command formats only.
Selenium IDE cant be used to execute complex test scenarios involving dynamic objects and values.
Does not support the implementation of condition statements, iterations, exception handling.
Limitations of Selenium RC:
If there are some complex request/response on the page, writing custom waitFor method is difficult.
Limited ability to run multiple scripts consistently.
Though RC has several ways to identify elements on the page, the locator supports only some
common attributes such as “ID, names, xpath”.
Similarly if the RC needs to interact with an non natives objects in the web page like calender widget ,
multi frames.
16AVACORP © 2011
Thank You
India Guna Complex,7th floor, Main Building #443 (304),Anna Salai, Teynampet,Chennai-600 018. +91-44-42132992
India – Branch OfficeEast West Center,3rd & 4th Floor, #128,Nelson Manickam Road,Aminjikarai,Chennai - 600 029. +91-44-23741122
USA379 Thornall St 12th floorEdison, New JerseyZip 08820+1 732 331 3098
Global Headquarters