Post on 17-Jan-2015
description
1
Automated Keyword Driven Framework using
Selenesse
Ameya NaikRasika Doshi
2
Challenges in Test Automation
Automation Frameworks
The SeleNesse Framework Selenium
FitNesse
Selenesse Library
Demo
Pros & Cons
Contents
3
Limited Skilled Resources
Tool support
Framework Maintenance
Limited Skilled Resources
Tool support
Framework Maintenance
Understanding the
Automation Scripts
Sharing Results with
Management/Client
Understanding the
Automation Scripts
Sharing Results with
Management/Client
Challenges in Test Automation
4
Automation Frameworks
5
Script actions as well as data are maintained outside of the automation script. Enables documentation of functionality in a tabular format.
Test Scripts are represented as step by step instructions (similar to Manual test cases).
Window Control Action Arguments
Window 1 Menu Click File, Open
Window 2 Pushbutton Click Folder Name
Window 3 Verify Results
Keyword Driven Framework
6
Front EndFront End DriverDriver ToolTool ApplicationApplication
SeleNesse Architecture
7
Open source tool for Functional testing of
web applications.
Supports multiple scripting languages like Java,
C#, Ruby, Python, PHP, Perl, etc
Supports playback on multiple browsers - IE, FF, Chrome, Safari.
Supports multiple operating systems - Windows, Linux, Mac OS X, Solaris, Android*, iPhone* (* Selenium 2.0 and higher)
Fast growing user community.
Selenium
8
Fitnesse is a lightweight, open-source framework for automated testing.
It helps to collaboratively define and organize acceptance / functional tests
It works as a Wiki to easily create and edit Scripts and documentation.
FitNesse
9
Fitnesse Fixtures are the bridges between the tables and the AUT. Fixtures process the table commands and drive the AUT. They capture the
results and send them back to FitNesse.
FitNesse Table:
Fixture Code:public class Division {
private double numerator, denominator;public void setNumerator(double numerator) {this.numerator = numerator;}public void setDenominator(double denominator} {this.denominator = denominator;}public double quotient() {return numerator/denominator;}
}
public class Division {private double numerator, denominator;public void setNumerator(double numerator) {this.numerator = numerator;}public void setDenominator(double denominator} {this.denominator = denominator;}public double quotient() {return numerator/denominator;}
}
Eg. Division
Numerator denominator quotient?
10 2 5.0
12.6 3 4.2
100 4 33
FitNesse Fixtures
10
Developed by Marisa Seal, Dawn Cannan and Chris McMahon.
It is a Fitnesse Fixture that connects to Selenium which connects to the actual AUT (Web project).
FitNesse Table:
Fixture
SlimSelenium1Driver.java
https://github.com/marisaseal/selenesse/blob/master/src/selenesse/SlimSeleniumDriver.java
open www.google.co.in
type; q Selenesse
windowFocus
windowMaximize
click btnG
ensure isTextPresent Selenese
SeleNesse
11
Methods for Verification|check|getText|<locator>|<expected text>||ensure|isTextpresent|controlLocator||reject|isTextpresent|controlLocator| |$checkbox=|get attribute|//img[@id='enableRequest']/@src|
|check|getText|<locator>|<expected text>||ensure|isTextpresent|controlLocator||reject|isTextpresent|controlLocator| |$checkbox=|get attribute|//img[@id='enableRequest']/@src|
Methods for checkbox / Radio buttons|makeChecked|<locator>||makeUnchecked|<locator>||makeChecked|<locator>||makeUnchecked|<locator>|
Note: All Verify methods in Selenium can be accessed as is* methods.
e.g. ‘verifyTextPresent’ becomes ‘isTextPresent’, ‘verifyElementPresent’ becomes ‘isElementPresent’
Special Commands
java -jar fitnesse.jar -c "MyTestPage?test&format=text"java -jar fitnesse.jar -c "MyTestPage?test&format=text"
Command Line Interface
12
Feature Summary
13
Pre-Requisites
Selenium RC – http://seleniumhq.org/download http://saucelabs.com/downloads
FitNesse Server – http://fitnesse.org/FrontPage.FitNesseDevelopment.DownLoad
Selenesse Library – http://github.com/marisaseal/selenesse
Demo
14
Pros Cons
Provides Test Management in a browser. Test assets can be shared on demand.
Programming constructs like loops cannot be used in FitNesse. (can write fixtures / methods in SeleNesse to achieve the same result)
Inherent documentation in Wiki Pages.
Not tested for Huge projects with tens of thousands of test cases.
Scripts can be shared for Manual & Automation tests
Requires 2 servers to be running for FitNesse and Selenium.
Importing from spreadsheet is possible
No commercial support. Have to depend on community for support.
Customizable and Extensible FitNesse syntax / format needs to be learnt.
Hides complexity of code from end users
Quick and Easy Setup
Good fit for Agile Teams.
Pros & Cons
15
?
Questions
16
Ameya Naikanaik@spiderlogic.com
Rasika Doshirdoshi@spiderlogic.com
Thank You
17
18
We can create a custom method to the Selenesse JAR file. This method can then be called directly from Fitnesse tables.
public boolean verifyComboItemPresent (String selectLocator, String value) {boolean elementFound = seleniumInstance.isElementPresent(selectLocator);
if (elementFound) {String[] retrievedOptions = seleniumInstance.getSelectOptions(selectLocator);for (int i=0; i<retrievedOptions.length; i++) {
if (retrievedOptions[i].equals(value)) {return true;
}}System.out.println("The requested item '"+value+"' was not found in the Combo box");return false;
}System.out.println("The Combo box was not found on the page");return false;
}
public boolean verifyComboItemPresent (String selectLocator, String value) {boolean elementFound = seleniumInstance.isElementPresent(selectLocator);
if (elementFound) {String[] retrievedOptions = seleniumInstance.getSelectOptions(selectLocator);for (int i=0; i<retrievedOptions.length; i++) {
if (retrievedOptions[i].equals(value)) {return true;
}}System.out.println("The requested item '"+value+"' was not found in the Combo box");return false;
}System.out.println("The Combo box was not found on the page");return false;
}
open http://www.quikr.com/
ensure isTextPresent Welcome to Quikr
verifyComboItemPresent
categoryId Pune
19
20
Order of method execution
The order of method execution is as follows:
1. Find method on fixture, if present execute2. Find method on SystemUnderTest, if present execute3. Find method on installed Library in reversed order of creation. So last one created takes precedence over the ones created earlier.
More on Fixtures…
SYSTEM UNDER TEST
Using SystemUnderTest allows you to let SliM directly invoke a method on your SystemUnderTest without having to create a method in a SliM fixture for it. Currently only available in Java.