Swift Automation Ride With Omelet

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

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 ?

Sequential Data Parallel Tests 

OK whats next ?

Multi Parallel

Little extra

Run Strategy

Full

Optimal

How fast we can go ?

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 ?

Verification Failure

Script Failure

Video in Reports

Clean Code

  • No more try catch blocks for handling closing of Drivers
  • DriverUtility class 
  • ExpectedConditionExtended class to compliment Page Object Design Pattern

Re-Run Failed Test Cases

retryfailedtestcase = 1

Irrespective of count Test cases are reported only once

Extra Package

Separation of Data

  1. Xml Configuration
  2. GoogleSheets

XMl Configuration

Mapping.xml

     TestData.xml

     BrowserConfig.xml

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

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

Google Mapping

Google Browser Configuration

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

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

  • 1,539
Loading comments...

More from kapil aggarwal