SlideShare a Scribd company logo
1 of 51
Download to read offline
Automated
Acceptance Test
~ How to build it stable & maintainable
Bryan
QA
Programmer
Automation Engineer
DevOps Evangelist &
Facilitator
Big Data
Ad Exchange (RTB)
Low Latency
High Concurrency
(We are hiring)
Automated Acceptance Test
In Continuous Delivery
• “Are we good to go live?”
- Test jobs are your “eyes and ears”
- Optimize for them!
• Test code equals production code
Common problems:
• Costly to maintain test buckets
• Spent much time running and debugging false alarms
Acceptance Test
“ An Executable Specification of
System Behaviour ”
Culture
~ Responsibilities?
< 100 ms
What’s AD
Exchange
“ Don’t have a separate Testing/QA team!
Quality is down to everyone - Developer owns Acceptance Tests!! ”
― David Farley, Pipeline Conf. 2015
“ Not enough to have acceptance test and acceptance test got to be
created and maintained by developer
will make code more testable and maintainable. ”
― Jez Humble, Pipeline Conf. 2016
don’t hire too many dedicated testers
developer relies on them, lazier and write more bugs
hire people who can development and test functions
code review occupies a central position
no separate group of tester or QA people
relies on automated testing
“Testing is essentially the responsibility of the person
who develops a given feature”
(tens of thousands of regression tests)
developer responsible for writing unit tests, regression
tests and performance tests
regulated FX exchange
London & Tokyo
launched 2010
~ $2 trillion traded in 2015
one of UK’s fastest growing technology companies
high quality - very low rate of production issues
(order of magnitude below industry average)
“lowest bug count we’ve ever found”

- independent analysis by a well-known tool vendor
2 million lines of code
(50:50 test/production)
half the codebase < 18 months old
Process / Discipline
~ Definition of done
Definition of Done
• Automation task and sprint end demo
• Code review
• Pipeline dashboard
- pipeline always in deliverable status
- statistic analysis report
• Build and unit tests
• Full acceptance against the change sets
• Only delivered if above passed
Definition of Done
• Code review of automated test scripts
• Loop test suite 20 times before code merge
Loop of Your Tests
stage concurrency: 1, name: ‘Test Looping before merge'

docker.image('qa/chrome-slave:2.53.0').inside('-v /dev/shm:/dev/shm --privileged=true') {

wrap([$class: 'Xvfb', additionalOptions: '-fbdir /tmp']) {

git branch: 'develop', url: 'http://abc.com/qa/accept-test.git'

withEnv(["baseUrl=${baseUrl}","mySQLUrl=${mySQLUrl}"]) {

for(int i = 0; i < count; i++) {
println(“Loop of: ${i}”)
sh 'mvn -B test -fae —DsuiteXmlFile=testng.xml’
}

}

}

}
Jenkins Scriptable Build
& Multibranch Pipeline
Immutable Environment
• Dockerize environments for build & test
- Always fresh
- Quick
- Immutable
- Scalable & parallel
• Dockerize testing infrastructure
Strategies
~ How to make good one
Test Automation Pyramid
src: http://www.ontestautomation.com/tag/mike-cohn/
Test Isolation
• Reliability/Repeatability
- Provide consistent, repeatable results.
• Isolation
- Tests should not depend, or be affected by, the results of
other tests: testContext
- users, accounts, advertiser names etc: alias name
- external services, 3rd-party integrations: stub, simulator
account: ‘Johnny’
==> ‘Johnny_4534031’
book: ‘DevOps 101’
==> ‘DevOps 101_1234567’
Parallelisation
• Commit stage < 15 mins
• Acceptance Test stage < 45 mins
• Fail FASTer!
• Radical parallelisation
- throw-away environments (e.g. containers)
Separation of Concern
• Use Domain Specific Language (DSL)
- Focus on “What” not “How”
• Ease of Development
- Hide details of how the tests talk to the SUT
• Ease of Maintenance
- When tests break, we Identify the problem and fix it quickly.
‘What’ Not
‘How’
‘What’ Not
‘How’
‘What’ Not
‘How’
Focus on
‘What’
Not
‘How’
API Example
@Given("^I create a advertiser with those fields fill : name '(.+)', state '(.+)', currency '(.+)'$")

public void createAdvertiser(final String name, final String state, final String currency) {

advertiserAPI.createDefaultAdvertiser(name, state, currency);

}
package com.vpon.dsp.driver.web.rest.service.adv;

public class AdvertiserServiceImpl {

static { AdvertiserService advService = ServiceGenerator.createService(AdvertiserService.class); }

public static String createAdvertiser(Advertiser obj) throws IOException{

Call<Advertiser> advExec = advService.createAdvertiser(obj);

Response<Advertiser> resp = advExec.execute();
// id should not be null if created successfully

if(resp.isSuccessful() && null != resp.body().id) {

...
}}}
package com.vpon.dsp.dsl.web;

public String createDefaultAdvertiser(String name) {

Advertiser obj = defaultAdvertiser(name);

return AdvertiserServiceImpl.createAdvertiser(obj);

}
DSL layer:
Driver layer:
Test case layer:
Implementation
~ Right tools
API Test
“ API is more than just a status code,
Verify every part of it.”
API Test
Concerns?
• Support DevOps - high frequent delivery & BDD
• Maintainability - UI, API are volatile, avoid boilerplate code
• Tools: SoapUI, REST-assured, POSTMAN, Unirest
Test Case Example
Goal
@end2end

Feature: LineItem end-to-end system targeting test


Background: An Advertiser, LineItem with different System targeting conditions created

Given There is a 'advTargeting' advertiser and following 'System' targeting lineItems:

| name | category | targeting |

| LI_OS_iOS | OS Family | Apple iOS |

| LI_LANG_Eng | Language | English |



Scenario Outline: Bid accordingly with lineItem targeting setting

Given I enable '<lineItemName>' lineItem

When I send a bid request with '<criteria>' targeting only

And I send a 'default' bid request with no targeting criteria

Then I should receive '1' successful bid response



Examples:

| lineItemName | criteria |

| "LI_OS_iOS" | "iOS" |

| "LI_LANG_Eng" | "English" |
Retrofit
A type-safe
HTTP client
for
Android
and
Java
GUI (Flaky) Test
Stability is super important for automation in CD
• 1% failure rate with 100 test scripts ( 0.99¹⁰⁰) = 63% chance of failure
• You can’t get away with flaky tests in CI/CD
• Spend much time debugging false alarms
Selenium + jQuery Selector
• Implement JQueryBy class
- Tells Selenium how to find element with jQuery locator
• If no jQuery in application page
- Inject one for testing
• jQuery
- Powerful API for navigating and selecting content
- Manipulate UI for easy assertion
- CSS based, a whole lot better than XPath
- Has “qualified” feature (ex: has, contains) for filtering
• No xPath locator
- Slow & tight to DOM structure
- Easily broken with html changes
- Bad readability and hard to maintain
Selenium PageObject
• Separate test logic from web implementation
- No html stuff (locator, Selenium code, …) in test case
• Increase maintainability
- No need to update all hundreds of TCs when UI changes
- Object classes are the only place to modify
• Increase stability
- More tuning on the framework, it gets more stable
src: Martin
Handling Wait in UI Test
User Perform
Action
if_Async
CheckPageReady()
Check Ajax Request
Complete
Wait Dynamic
Element Presence
Make Assertion
Check DB / Queue
Status Match
Thread.sleep()
Handling Wait in UI Test
• Each page loading is following the same ‘wait’ checking procedure
• Each page can define it’s own ‘getPageLoadCondition()’
public T initPage(Class<T> clazz) {
T page = PageFactory.initElements(getDriver(), clazz);
checkPageReady(); //<== check for DOM, JS lib
ExpectedCondition pageLoadCondition =
((AbstractPage) page).getPageLoadCondition();


// for extended page does not want to check loading condition ...
if (null != pageLoadCondition) {
waitForCondition(pageLoadCondition); //<== check for page’s load condition

}

return page;

}
Handling Wait in UI Test
private static void checkPageReady() {

/* for generic loading, but not all browsers compatible...
final String chk1 =
“(document.readyState==='complete'|| document.readyState===‘interactive')";
*/

final String chk1 =
"(typeof jQuery != 'undefined') && ($(window).load(function() {return true;}))";

//for jQuery loaded and no ajax requests pending

final String chk2 = "($.active === 0)";

final String condition = "return " + chk1 + " && " + chk2 + ";";

ExpectedCondition<Boolean> response = new ExpectedCondition<Boolean>() {

public Boolean apply(WebDriver d) {

return (Boolean)((JavascriptExecutor) d).executeScript(condition);

}

};

new WebDriverWait(getDriver(), LOAD_TIMEOUT).until(response);

}
//for those with data grid loading

public static ExpectedCondition getDataLoadingCondition() {

LogUtils.printDebugMessage(logger, "Before returning _loading wait condition...");

return new ExpectedCondition<Boolean>() {

public Boolean apply(WebDriver d) {

boolean result = (Boolean)((JavascriptExecutor) d).executeScript(

"return ($("div[id$='_loading'][style*='display: none;']").length===2" +

" && $.active===0 “ +
“ && $("div[id$='_loading'][style$='display: block;']").length===0)"

);

return result;

}

};

}
Wait Ajax Data Loading
(1) $.active === 0
=> No ajax reqs pending
(2) $(”div[id$=‘_loading’]…..”).length===0)
=> loading icon disappear
Wait Dynamic Web Element
public String getToolTipText() {

SeleniumDriver.onPage(ByJQuery.jQuerySelector("div#content"));

. . . . . 

//mouseover

new Actions(getDriver()).moveToElement(e).build().perform();

String toolTipLocator = "div.tooltip[style$='display: block;']";

LogUtils.printMessage(logger, "trying to get tooltips of a warning ...");

return SeleniumDriver.waitUntilElementPresence(
ByJQuery.jQuerySelector(toolTipLocator)).getText();

}
Capacity Testing
• Performance testing for components
• Long run and stress
• Use production traffic - boost confidence level
• Tools: Gor, Gatling
Reference
[How google Test Software]

[Continuous Delivery: Reliable Software Releases]
[From research paper “Moving Fast with Software Verification - 2015”]
Others:
https://dzone.com/articles/dev-centric-culture-breaking-down-the-walls
http://blog.xebialabs.com/2015/06/22/guidelines-for-a-successful-test-strategy/
http://www.androidwarriors.com/2015/12/retrofit-20-android-example-web.html
https://gortool.com/
http://gatling.io/#/
[About Vpon]
[About Me]
Q & A

More Related Content

What's hot

vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Learn jobDSL for Jenkins
Learn jobDSL for JenkinsLearn jobDSL for Jenkins
Learn jobDSL for JenkinsLarry Cai
 
Mete Atamel
Mete AtamelMete Atamel
Mete AtamelCodeFest
 
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Fwdays
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with DockerHanoiJUG
 
Jenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineJenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineSteffen Gebert
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene GroeschkeCodeFest
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...ZeroTurnaround
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsBo-Yi Wu
 
Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdJosh Padnick
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Yan Cui
 
Karim Fanadka
Karim FanadkaKarim Fanadka
Karim FanadkaCodeFest
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citruschristophd
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovyjgcloudbees
 
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana MandziukFwdays
 
JavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeJavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeBert Jan Schrijver
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
Dropwizard and Groovy
Dropwizard and GroovyDropwizard and Groovy
Dropwizard and Groovytomaslin
 

What's hot (20)

vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Learn jobDSL for Jenkins
Learn jobDSL for JenkinsLearn jobDSL for Jenkins
Learn jobDSL for Jenkins
 
Mete Atamel
Mete AtamelMete Atamel
Mete Atamel
 
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"Володимир Дубенко "Node.js for desktop development (based on Electron library)"
Володимир Дубенко "Node.js for desktop development (based on Electron library)"
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
 
Jenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipelineJenkins vs. AWS CodePipeline
Jenkins vs. AWS CodePipeline
 
Rene Groeschke
Rene GroeschkeRene Groeschke
Rene Groeschke
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjs
 
Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in Prod
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Karim Fanadka
Karim FanadkaKarim Fanadka
Karim Fanadka
 
Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citrus
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovy
 
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
 
JavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as codeJavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as code
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Dropwizard and Groovy
Dropwizard and GroovyDropwizard and Groovy
Dropwizard and Groovy
 

Similar to Automated acceptance test

Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 
Automate test, tools, advantages, and disadvantages
Automate test, tools, advantages,  and disadvantagesAutomate test, tools, advantages,  and disadvantages
Automate test, tools, advantages, and disadvantagesMajid Hosseini
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applicationsqooxdoo
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)Tobias Schneck
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018Tobias Schneck
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciollaAndrea Paciolla
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Continuous Delivery: How RightScale Releases Weekly
Continuous Delivery: How RightScale Releases WeeklyContinuous Delivery: How RightScale Releases Weekly
Continuous Delivery: How RightScale Releases WeeklyRightScale
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and EasybIakiv Kramarenko
 

Similar to Automated acceptance test (20)

Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
Browser testing with nightwatch.js
Browser testing with nightwatch.jsBrowser testing with nightwatch.js
Browser testing with nightwatch.js
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
Automate test, tools, advantages, and disadvantages
Automate test, tools, advantages,  and disadvantagesAutomate test, tools, advantages,  and disadvantages
Automate test, tools, advantages, and disadvantages
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Continuous Delivery: How RightScale Releases Weekly
Continuous Delivery: How RightScale Releases WeeklyContinuous Delivery: How RightScale Releases Weekly
Continuous Delivery: How RightScale Releases Weekly
 
Selenium
SeleniumSelenium
Selenium
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 

Automated acceptance test

  • 1. Automated Acceptance Test ~ How to build it stable & maintainable
  • 2.
  • 3. Bryan QA Programmer Automation Engineer DevOps Evangelist & Facilitator Big Data Ad Exchange (RTB) Low Latency High Concurrency (We are hiring)
  • 4. Automated Acceptance Test In Continuous Delivery • “Are we good to go live?” - Test jobs are your “eyes and ears” - Optimize for them! • Test code equals production code Common problems: • Costly to maintain test buckets • Spent much time running and debugging false alarms
  • 5. Acceptance Test “ An Executable Specification of System Behaviour ”
  • 7. < 100 ms What’s AD Exchange
  • 8.
  • 9. “ Don’t have a separate Testing/QA team! Quality is down to everyone - Developer owns Acceptance Tests!! ” ― David Farley, Pipeline Conf. 2015
  • 10.
  • 11. “ Not enough to have acceptance test and acceptance test got to be created and maintained by developer will make code more testable and maintainable. ” ― Jez Humble, Pipeline Conf. 2016
  • 12. don’t hire too many dedicated testers developer relies on them, lazier and write more bugs hire people who can development and test functions
  • 13. code review occupies a central position no separate group of tester or QA people relies on automated testing
  • 14. “Testing is essentially the responsibility of the person who develops a given feature” (tens of thousands of regression tests) developer responsible for writing unit tests, regression tests and performance tests
  • 15. regulated FX exchange London & Tokyo launched 2010 ~ $2 trillion traded in 2015 one of UK’s fastest growing technology companies
  • 16. high quality - very low rate of production issues (order of magnitude below industry average) “lowest bug count we’ve ever found”
 - independent analysis by a well-known tool vendor
  • 17. 2 million lines of code (50:50 test/production) half the codebase < 18 months old
  • 18. Process / Discipline ~ Definition of done
  • 19. Definition of Done • Automation task and sprint end demo • Code review • Pipeline dashboard - pipeline always in deliverable status - statistic analysis report
  • 20. • Build and unit tests • Full acceptance against the change sets • Only delivered if above passed Definition of Done
  • 21. • Code review of automated test scripts • Loop test suite 20 times before code merge Loop of Your Tests stage concurrency: 1, name: ‘Test Looping before merge'
 docker.image('qa/chrome-slave:2.53.0').inside('-v /dev/shm:/dev/shm --privileged=true') {
 wrap([$class: 'Xvfb', additionalOptions: '-fbdir /tmp']) {
 git branch: 'develop', url: 'http://abc.com/qa/accept-test.git'
 withEnv(["baseUrl=${baseUrl}","mySQLUrl=${mySQLUrl}"]) {
 for(int i = 0; i < count; i++) { println(“Loop of: ${i}”) sh 'mvn -B test -fae —DsuiteXmlFile=testng.xml’ }
 }
 }
 }
  • 22. Jenkins Scriptable Build & Multibranch Pipeline
  • 23. Immutable Environment • Dockerize environments for build & test - Always fresh - Quick - Immutable - Scalable & parallel • Dockerize testing infrastructure
  • 24. Strategies ~ How to make good one
  • 25. Test Automation Pyramid src: http://www.ontestautomation.com/tag/mike-cohn/
  • 26. Test Isolation • Reliability/Repeatability - Provide consistent, repeatable results. • Isolation - Tests should not depend, or be affected by, the results of other tests: testContext - users, accounts, advertiser names etc: alias name - external services, 3rd-party integrations: stub, simulator account: ‘Johnny’ ==> ‘Johnny_4534031’ book: ‘DevOps 101’ ==> ‘DevOps 101_1234567’
  • 27. Parallelisation • Commit stage < 15 mins • Acceptance Test stage < 45 mins • Fail FASTer! • Radical parallelisation - throw-away environments (e.g. containers)
  • 28. Separation of Concern • Use Domain Specific Language (DSL) - Focus on “What” not “How” • Ease of Development - Hide details of how the tests talk to the SUT • Ease of Maintenance - When tests break, we Identify the problem and fix it quickly.
  • 33. API Example @Given("^I create a advertiser with those fields fill : name '(.+)', state '(.+)', currency '(.+)'$")
 public void createAdvertiser(final String name, final String state, final String currency) {
 advertiserAPI.createDefaultAdvertiser(name, state, currency);
 } package com.vpon.dsp.driver.web.rest.service.adv;
 public class AdvertiserServiceImpl {
 static { AdvertiserService advService = ServiceGenerator.createService(AdvertiserService.class); }
 public static String createAdvertiser(Advertiser obj) throws IOException{
 Call<Advertiser> advExec = advService.createAdvertiser(obj);
 Response<Advertiser> resp = advExec.execute(); // id should not be null if created successfully
 if(resp.isSuccessful() && null != resp.body().id) {
 ... }}} package com.vpon.dsp.dsl.web;
 public String createDefaultAdvertiser(String name) {
 Advertiser obj = defaultAdvertiser(name);
 return AdvertiserServiceImpl.createAdvertiser(obj);
 } DSL layer: Driver layer: Test case layer:
  • 35. API Test “ API is more than just a status code, Verify every part of it.”
  • 37. Concerns? • Support DevOps - high frequent delivery & BDD • Maintainability - UI, API are volatile, avoid boilerplate code • Tools: SoapUI, REST-assured, POSTMAN, Unirest
  • 39. Goal @end2end
 Feature: LineItem end-to-end system targeting test 
 Background: An Advertiser, LineItem with different System targeting conditions created
 Given There is a 'advTargeting' advertiser and following 'System' targeting lineItems:
 | name | category | targeting |
 | LI_OS_iOS | OS Family | Apple iOS |
 | LI_LANG_Eng | Language | English |
 
 Scenario Outline: Bid accordingly with lineItem targeting setting
 Given I enable '<lineItemName>' lineItem
 When I send a bid request with '<criteria>' targeting only
 And I send a 'default' bid request with no targeting criteria
 Then I should receive '1' successful bid response
 
 Examples:
 | lineItemName | criteria |
 | "LI_OS_iOS" | "iOS" |
 | "LI_LANG_Eng" | "English" |
  • 41. GUI (Flaky) Test Stability is super important for automation in CD • 1% failure rate with 100 test scripts ( 0.99¹⁰⁰) = 63% chance of failure • You can’t get away with flaky tests in CI/CD • Spend much time debugging false alarms
  • 42. Selenium + jQuery Selector • Implement JQueryBy class - Tells Selenium how to find element with jQuery locator • If no jQuery in application page - Inject one for testing • jQuery - Powerful API for navigating and selecting content - Manipulate UI for easy assertion - CSS based, a whole lot better than XPath - Has “qualified” feature (ex: has, contains) for filtering • No xPath locator - Slow & tight to DOM structure - Easily broken with html changes - Bad readability and hard to maintain
  • 43. Selenium PageObject • Separate test logic from web implementation - No html stuff (locator, Selenium code, …) in test case • Increase maintainability - No need to update all hundreds of TCs when UI changes - Object classes are the only place to modify • Increase stability - More tuning on the framework, it gets more stable src: Martin
  • 44. Handling Wait in UI Test User Perform Action if_Async CheckPageReady() Check Ajax Request Complete Wait Dynamic Element Presence Make Assertion Check DB / Queue Status Match Thread.sleep()
  • 45. Handling Wait in UI Test • Each page loading is following the same ‘wait’ checking procedure • Each page can define it’s own ‘getPageLoadCondition()’ public T initPage(Class<T> clazz) { T page = PageFactory.initElements(getDriver(), clazz); checkPageReady(); //<== check for DOM, JS lib ExpectedCondition pageLoadCondition = ((AbstractPage) page).getPageLoadCondition(); 
 // for extended page does not want to check loading condition ... if (null != pageLoadCondition) { waitForCondition(pageLoadCondition); //<== check for page’s load condition
 }
 return page;
 }
  • 46. Handling Wait in UI Test private static void checkPageReady() {
 /* for generic loading, but not all browsers compatible... final String chk1 = “(document.readyState==='complete'|| document.readyState===‘interactive')"; */
 final String chk1 = "(typeof jQuery != 'undefined') && ($(window).load(function() {return true;}))";
 //for jQuery loaded and no ajax requests pending
 final String chk2 = "($.active === 0)";
 final String condition = "return " + chk1 + " && " + chk2 + ";";
 ExpectedCondition<Boolean> response = new ExpectedCondition<Boolean>() {
 public Boolean apply(WebDriver d) {
 return (Boolean)((JavascriptExecutor) d).executeScript(condition);
 }
 };
 new WebDriverWait(getDriver(), LOAD_TIMEOUT).until(response);
 }
  • 47. //for those with data grid loading
 public static ExpectedCondition getDataLoadingCondition() {
 LogUtils.printDebugMessage(logger, "Before returning _loading wait condition...");
 return new ExpectedCondition<Boolean>() {
 public Boolean apply(WebDriver d) {
 boolean result = (Boolean)((JavascriptExecutor) d).executeScript(
 "return ($("div[id$='_loading'][style*='display: none;']").length===2" +
 " && $.active===0 “ + “ && $("div[id$='_loading'][style$='display: block;']").length===0)"
 );
 return result;
 }
 };
 } Wait Ajax Data Loading (1) $.active === 0 => No ajax reqs pending (2) $(”div[id$=‘_loading’]…..”).length===0) => loading icon disappear
  • 48. Wait Dynamic Web Element public String getToolTipText() {
 SeleniumDriver.onPage(ByJQuery.jQuerySelector("div#content"));
 . . . . . 
 //mouseover
 new Actions(getDriver()).moveToElement(e).build().perform();
 String toolTipLocator = "div.tooltip[style$='display: block;']";
 LogUtils.printMessage(logger, "trying to get tooltips of a warning ...");
 return SeleniumDriver.waitUntilElementPresence( ByJQuery.jQuerySelector(toolTipLocator)).getText();
 }
  • 49. Capacity Testing • Performance testing for components • Long run and stress • Use production traffic - boost confidence level • Tools: Gor, Gatling
  • 50. Reference [How google Test Software] [Continuous Delivery: Reliable Software Releases] [From research paper “Moving Fast with Software Verification - 2015”] Others: https://dzone.com/articles/dev-centric-culture-breaking-down-the-walls http://blog.xebialabs.com/2015/06/22/guidelines-for-a-successful-test-strategy/ http://www.androidwarriors.com/2015/12/retrofit-20-android-example-web.html https://gortool.com/ http://gatling.io/#/ [About Vpon] [About Me]
  • 51. Q & A