Swift Automation Ride With Omelet
Lets cook some tests!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/775631/automation.jpg)
Case Study
Green Field Projects
- More unit tests
- Speed for test execution
- Continuous integration
- Automation all the way
- Clear Test Result
- Less Documentation
Brown Field Projects
- Speed for Test execution
- More UI Tests
- Clear Test Results
- Quick Test case creation
Pain Areas For Automation Testing
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1468931/jenkins-ci_128.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1468950/Report.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1468967/Automation.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1468987/Documentation.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469056/fast.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469075/browsers.jpg)
Lets Start
Agenda
- Multi-Parallel Cross Browser Testing
- Scaling tests to cloud/Local Infra
- Verification/Script failure
- Videos in Reports
- Clean Code
- Test Data - Xml/Google Sheets
- CI Integration
- Demo
Parallel Testing
Yes we know this ?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767573/prallel.jpg)
Sequential Data Parallel Tests
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767586/data-parallel.jpg)
OK whats next ?
Multi Parallel
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767604/Multiparallel.jpg)
Little extra
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767637/Optimal-Parallel.jpg)
Run Strategy
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767666/RunStrategy-Full.jpg)
Full
Optimal
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/767680/Optimal-RunStartegy.jpg)
How fast we can go ?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1468588/IMG_20150608_172117.jpg)
Scale your tests in no time to Cloud or Local Infra
Cloud - BrowserStack, Sauce, Testing bot etc
- Switch for running local test cases to BS
- remoteflag=True
remoteflag = true
#BrowserStack Configuration
dc.platform = "Windows 8.1"
browsername="internet explorer"
dc.version="11.0"
remoteflag = "true"
host="ondemand.saucelabs.com"
port="80"
username = "Your username"
key = "yourkey"
Distribute Test Cases to Nodes
- Switch to run local test cases on hub-nodes
- Easy configuration of Hub-Url in framework.properties or Browser Configuration
remoteflag=True
host=192.168.88.142
port=4444
Soft Assert For Step Level Report
Text
public class TestClass{
Sassert sassert = new Sassert();
@Test(Data...)
public void testMethod(){
sassert.assertTrue(true,"this is test step1");
sassert.assertEqual(1,1,"verify if integers are equal");
sassert.assertAll();
}
Script Failure Vs Test Failure
Are you sure your automation scripts are working fine ?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469144/comparison.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/775309/FailedScreenShot.jpg)
Verification Failure
Script Failure
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/775351/ScriptFailure.jpg)
Video in Reports
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469271/video.png)
Clean Code
- No more try catch blocks for handling closing of Drivers
- DriverUtility class
- ExpectedConditionExtended class to compliment Page Object Design Pattern
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469090/clean.png)
Re-Run Failed Test Cases
retryfailedtestcase = 1
Irrespective of count Test cases are reported only once
Extra Package
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1469237/email_cartoon.png)
Separation of Data
- Xml Configuration
- GoogleSheets
XMl Configuration
Mapping.xml
TestData.xml
BrowserConfig.xml
![](https://s3.amazonaws.com/media-p.slid.es/uploads/kapilaggarwal-1/images/771736/XmlConf.jpg)
Why Mapping?
We need to tell framework which browser and which data to be used
Mapping.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Mapping [ <!ELEMENT Mapping (Package+)>
<!ATTLIST Package name CDATA #REQUIRED>
<!ATTLIST Package testData CDATA #IMPLIED>
<!ATTLIST Package clientEnvironment CDATA #IMPLIED>
<!ATTLIST Package runStrategy (Full|Optimal) #IMPLIED>
<!ELEMENT Package (Class*)>
<!ATTLIST Class name CDATA #REQUIRED>
<!ATTLIST Class clientEnvironment CDATA #IMPLIED>
<!ATTLIST Class testData CDATA #IMPLIED>
<!ATTLIST Class runStrategy (Full|Optimal) #IMPLIED>
<!ELEMENT Class (MethodName*)>
<!ATTLIST MethodName name CDATA #REQUIRED>
<!ATTLIST MethodName testData CDATA #IMPLIED>
<!ATTLIST MethodName clientEnvironment CDATA #IMPLIED>
<!ATTLIST MethodName runStrategy (Full|Optimal) #IMPLIED>]>
<Mapping>
<Package name="com.springer.test.datatest" testData="data/TestData_1.xml"
runStrategy="Optimal">
<Class name="com.springer.test.datatest.GoogleTest" clientEnvironment="browsers/FireFoxLocal.xml;browsers/ChromeLocal.xml">
<MethodName name="verifySeleniumTitle" testData="data/TestData_1.xml"/>
</Class>
</Package>
</Mapping>
Test Data
Subtitle
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1517289/TestData.png)
Browser Configuration
CommandLine
ClientEnvironment
FrameworkProperties
Command Line
mvn clean install -Dbrowsername=Firefox -Dremoteflag=true ......
All the configuration done in Browser Configuration or Framework.properties can be overriden by JVM argumnets
Browser Configuration
<ClientEnvironments>
<ClientEnvironment
dc.platform = "XP"
browsername="firefox"
dc.version="37.0"
remoteflag = "true"
host="ondemand.saucelabs.com"
port="80"
username = ""
key = ""
/>
<ClientEnvironment
dc.platform = "XP"
browsername="chrome"
dc.version="42.0"
remoteflag = "true"
host="hub.browserstack.com"
port="80"
username = ""
key = ""
/>
<ClientEnvironment
dc.platform = "Windows 8.1"
browsername="internet explorer"
dc.version="11.0"
remoteflag = "true"
host="ondemand.saucelabs.com"
port="80"
username = ""
key = ""
/>
</ClientEnvironments>
Framework Properties
browsername - (FireFox|Chrome|IE|HTML)
remoteflag - Whether we want to run on Remote - remote can be HUB or BrowserStack
host - HUB host like (127.0.0.1) or cloud host like "hub.browserstack.com"
username - Username for Cloud
key - key for cloud
drivertimeOut - Integer value which is implicit wait for our driver
chromeserverpath - if remoteflag = false and browsername=Chrome , then location of Chrome Server
ieserverpath -if remoteflag = false and browsername=IE , then location of ieServer
screenshotflag - Boolean value to take screenshot of the failure test cases
highlightelementflag - utility to higlight clicking of element before clicking and entering text in webelement
#Any desired capability, it should be preceded with dc.
dc.platform=Windows
Google Sheets
- Single Mapping Sheet
- n Browser Sheets
- n Test Data sheets
- Simple Authentication with googleUserName and googlePassword and googleSheetName
mvn clean install -DgoogleUserName=usergmail@gmail.com
-DgooglePassword=yourpasswd -DgoogleSheetName=sheetName -Denv-type=live
Sample Google Sheets
https://docs.google.com/spreadsheets/d/1KcK0UjhaANCigadSJxk71uPPuJsqvxBoatkop-e_wQM/edit?usp=sharing
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1518898/GoogleMapping.png)
Google Mapping
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1518899/GoogleBrowser.png)
Google Browser Configuration
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1518901/GoogleTestData.png)
Google Test Data
CI Integration
As everything can be controlled by command line --> Easy CI integration
Vagrant Box for Development
https://github.com/springer-opensource/omelet-dev-box
Challenges with Omelet
- Tight integration with TestNG
- Though not steep , but still learning curve
- Not big fan of BDD
Contribution
- New requirement can be raised as Issue on github.
- New pull request always welcomed.
- Trello board for upcoming developments :https://trello.com/b/CSHX34NU/omelet-development
- Documentation is under gh-pages branch
Upcoming Features/To Dos
- Responsive Website testing
- Jira Integration
- Testlink integration
- Increase documentation
- Unit Test cases
Jira Teaser
![](https://s3.amazonaws.com/media-p.slid.es/uploads/199554/images/1471631/jira.png)
Questions?
Demo
Thank You
kapil.aggarwal1@gmail.com
http://springer-opensource.github.io/omelet/
Omelet
By kapil aggarwal
Omelet
Java framework for Selenium built on top of TestNG
- 4,375