SlideShare une entreprise Scribd logo
1  sur  97
Télécharger pour lire hors ligne
Automated Test Hell
Wojciech Seliga
wojciech.seliga@spartez.com, @wseliga
or There and Back Again
About me
• Coding since 6yo	

• Former C++ developer (’90s, early ’00s)	

• Agile Practices (inc.TDD) since 2003	

• Dev Nerd,Tech Leader, Agile Coach,
Speaker, PHB	

• 6.5 years with Atlassian (JIRA Dev Manager)	

• Spartez Co-founder & CEO
XP Promise
CostofChange
Time
Waterfall
XP
The Story
2.5 years ago
About 50 engineers
Obsessed with Quality
Almost 10 years
of accumulating
garbage automatic tests
18 000 tests* on all levels
13 000 unit tests
*excluding tests of the libraries
4 000 func and integration tests
1 000 Selenium tests
Atlassian JIRA
Our
Continuous Integration
environment
Test frameworks
• JUnit 3 and 4
• JMock, Easymock, Mockito
• Powermock, Hamcrest
• QUnit, HTMLUnit, Jasmine.js, Sinon.js
• JWebUnit, Selenium, WebDriver
• Custom runners
Bamboo Setup
• Dedicated server with 70+ remote
agents (including Amazon Elastic)
• Build engineers
• Bamboo devs on-site
Looks good so far?
for each main branch
Run in parallel
in batches
Run first
There
is
Much
More
Type of tests
• Unit
• Functional
• Integration
• Platform
• Performance
Platforms
• Dimension - DB: MySQL, PostgreSQL, MS
SQL, Oracle
• Dimension - OS: Linux, Windows
• Dimension - Java ver.: 1.5, 1.6, 1.7, 1.8
• Dimension - CPU arch.: 32-bit, 64-bit
• Dimension - Deployment Mode:
Standalone, Tomcat, Websphere, Weblogic
Run Nightly
Coming
Triggering Builds
• On Commit (hooks, polling)
• Dependent Builds
• Nightly Builds
• Manual Builds
Very slow (long hours)
and fragile feedback loop
Serious performance and
reliability issues
It takes time to fix it...
Sometimes very long
You commit at 3 PM
You get “Unit Test Green” email at 4PM
You get flood of “Red Test X” emails at 4 - 9PM
Your colleagues on the
other side of the globe
You happily go home
You
“We probably spend more
time dealing with the JIRA
test codebase than the
production codebase”
Dispirited devs
accepting RED as a norm
Broken window theory
Feedback
Speed
`
Test
Quality
Catching up with UI
changes
Page Objects Pattern
Problem:
Solution:
Page Objects Pattern
• Page Objects model UI elements (pages,
components, dialogs, areas) your tests
interact with
• Page Objects shield tests from changing
internal structure of the page
• Page Objects generally do not make
assertions about data. The can assert
the state.
• Designed for chaining
Page Objects Example
public class AddUserPage extends AbstractJiraPage!
{!
!
private static final String URI = !
"/secure/admin/user/AddUser!default.jspa";!
!
@ElementBy(name = "username")!
private PageElement username;!
!
@ElementBy(name = "password")!
private PageElement password;!
!
@ElementBy(name = "confirm")!
private PageElement passwordConfirmation;!
!
@ElementBy(name = "fullname")!
private PageElement fullName;!
!
@ElementBy(name = "email")!
private PageElement email;!
!
@ElementBy(name = "sendemail")!
private PageElement sendEmail;!
!
@ElementBy(id = "user-create-submit")!
private PageElement submit;!
!
@ElementBy (id = "user-create-cancel")!
private PageElement cancelButton;!
!
@Override!
public String getUrl()!
{!
return URI;!
}!
...
@Override!
public TimedCondition isAt()!
{!
return and(username.timed().isPresent(), !
password.timed().isPresent(), fullName.timed().isPresent());!
}!
!
public AddUserPage addUser(final String username, !
final String password, final String fullName, final String
email, final boolean receiveEmail)!
{!
this.username.type(username);!
this.password.type(password);!
this.passwordConfirmation.type(password);!
this.fullName.type(fullName);!
this.email.type(email);!
if(receiveEmail) {!
this.sendEmail.select();!
}!
return this;!
}!
!
public ViewUserPage createUser()!
{!
return createUser(ViewUserPage.class);!
}!
!
!
public <T extends Page> T createUser(Class<T> nextPage,
Object...args)!
{!
submit.click();!
return pageBinder.bind(nextPage, args);!
}!
Using Page Objects
@Test!
public void testServerError()!
{!
jira.gotoLoginPage().loginAsSysAdmin(AddUserPage.class)!
.addUser("username", "mypassword", "My Name",!
"sample@email.com", false)!
.createUser();!
// assertions here!
}!
Opaque Test Fixtures
REST-based Set-up
Problem:
Solution:
REST-based Setup
@Before!
public void setUpTest() {!
restore("some-big-xml-file-with-everything-needed-inside.xml");!
}!
@Before!
public void setUpTest() {!
restClient.restoreEmptyInstance();!
restClient.createProject(/* project params */);!
restClient.createUser(/* user params */);!
restClient.createUser(/* user params */);!
restClient.createSomethingElse(/* ... */);!
}!
VS
Flakey Tests
Timed Conditions
Problem:
Solution:
Mock Unreliable Deps
Test-friendly Markup
Flakey Tests
Quarantine
Problem:
Solution:
Fix Eradicate
Quarantine
• @Ignore
• @Category
• Quarantine on CI server
• Recover or Die
Non-deterministic tests are
strong inhibitor of change
instead of the catalyst
Execution Time:
Test Level
Unit Tests
REST API Tests
JWebUnit/HTMLUnit Tests
Selenium/WebDriver Tests
Speed Confidence
Our example:
Front-end-heavy web app
100 WebDriver tests:
100 QUnit tests:
15 minutes
1.2 seconds
Test Pyramid
Unit Tests (including JS tests)
REST / HTML Tests
Selenium
Good!
Test Code is Not
Trash
Design
Maintain
Refactor
Share
Review
Prune
Respect
Discuss
Restructure
Optimum Balance
Isolation Speed Coverage Level Access Effort
Dangerous to temper with
MaintainabilityQuality / Determinism
Two years later…
People - Motivation
Making GREEN the norm
Shades of Red
Pragmatic CI Health
Build Tiers and Policy
Tier A1 - green soon after all commits
Tier A2 - green at the end of the day
Tier A3 - green at the end of the iteration
unit tests and functional* tests
WebDriver and bundled plugins tests
supported platforms tests, compatibility tests
Wallboards:
Constant
Awareness
Training
• assertThat over assertTrue/False and
assertEquals	

• avoiding races - Atlassian Selenium with its
TimedElement	

• Favouring unit tests over functional tests	

• Promoting Page Objects	

• Brownbags, blog posts, code reviews
Quality
Automatic Flakiness Detection
Quarantine
Re-run failed tests and see if they pass
Quarantine - Healing
SlowMo - expose races
Selenium 1
Selenium ditching
Sky did not fall in
Ditching - benefits
• Freed build agents - better system throughput	

• Boosted morale	

• Gazillion of developer hours saved	

• Money saved on infrastructure
Ditching - due diligence
• conducting the audit - analysis of the
coverage we lost	

• determining which tests needs to rewritten
(e.g. security related) 	

• rewriting the tests (good job for new hires
+ a senior mentor)
Flaky Browser-based Tests
Races between test code and asynchronous page logic
Playing with "loading" CSS class does not really help
Races Removal with Tracing
// in the browser:!
function mySearchClickHandler() {!
    doSomeXhr().always(function() {!
        // This executes when the XHR has completed (either success or failure)!
        JIRA.trace("search.completed");"
    });!
}!
// In production code JIRA.trace is a no-op
// in my page object:!
@Inject!
TraceContext traceContext;!
 !
public SearchResults doASearch() {!
    Tracer snapshot = traceContext.checkpoint();!
    getSearchButton().click(); // causes mySearchClickHandler to be invoked!
    // This waits until the "search.completed"

// event has been emitted, *after* previous snapshot    !
    traceContext.waitFor(snapshot, "search.completed"); !
    return pageBinder.bind(SearchResults.class);!
}!
Can we halve our build times?
Speed
Parallel Execution - Theory
End of Build
Batches
Start of Build
Parallel Execution
End of Build
Batches
Start of Build
Parallel Execution -
Reality Bites
End of Build
Batches
Start of Build
Agent
availability
Dynamic Test Execution
Dispatch - Hallelujah
"You can't manage what
you can't measure."
not by W. Edwards Deming
If you believe just in it 	

you are doomed.
You can't improve something
if you can't measure it
Profiler, Build statistics, Logs, statsd → Graphite
Anatomy of Build*
Compilation
Packaging
Executing Tests
Fetching Dependencies
*Any resemblance to maven build is entirely accidental
SCM Update
Agent Availability/Setup
Publishing Results
JIRA Unit Tests Build
Compilation (7min)
Packaging (0min)
Executing Tests (7min)
Fetching Dependencies (1.5min)
SCM Update (2min)
Agent Availability/Setup (mean 10min)
Publishing Results (1min)
Decreasing Test
Execution Time to
ZERRO
alone would not let us
achieve our goal!
Agent Availability/Setup
• starved builds due to
busy agents building
very long builds	

• time synchronization
issue - NTPD problem
• Proximity of SCM repo	

• shallow git clones are not so fast and lightweight +
generating extra git server CPU load	

• git clone per agent/plan + git pull + git clone per build
(hard links!)	

• Stash was thankful (queue)
SCM Update - Checkout time
2 min → 5 seconds
• Fix Predator	

• Sandboxing/isolation agent trade-off:

rm -rf $HOME/.m2/repository/com/atlassian/*

into

find $HOME/.m2/repository/com/atlassian/ 

-name “*SNAPSHOT*” | xargs rm	

• Network hardware failure found
(dropping packets)
Fetching Dependencies
1.5 min → 10 seconds
Compilation
• Restructuring multi-pom maven project
and dependencies	

• Maven 3 parallel compilation FTW



-T 1.5C

*optimal factor thanks to scientific trial and error research

7 min → 1 min
Unit Test Execution
• Splitting unit tests into 2 buckets: good and
legacy (much longer)	

• Maven 3 parallel test execution (-T 1.5C)
7 min → 5 min
3000 poor tests	

(5min)
11000 good tests	

(1.5min)
Functional Tests
• Selenium 1 removal did help	

• Faster reset/restore (avoid unnecessary
stuff, intercepting SQL operations for debug
purposes - building stacktraces is costly)	

• Restoring via Backdoor REST API	

• Using REST API for common setup/
teardown operations
Functional Tests
Publishing Results
• Server log allocation per test → using now
Backdoor REST API (was Selenium)	

• Bamboo DB performance degradation for
rich build history - to be addressed
1 min → 40 s
Unexpected Problem
• Stability Issues with our CI server	

• The bottleneck changed from I/O to CPU	

• Too many agents per physical machine
JIRA Unit Tests Build Improved
Compilation (1min)
Packaging (0min)
Executing Tests (5min)
Fetching Dependencies (10sec)
SCM Update (5sec)
Agent Availability/Setup (3min)*
Publishing Results (40sec)
Improvements Summary
Tests Before After Improvement %
Unit tests 29 min 17 min 41%
Functional tests 56 min 34 min 39%
WebDriver tests 39 min 21 min 46%
Overall 124 min 72 min 42%
* Additional ca. 5% improvement expected once new git clone
strategy is consistently rolled-out everywhere
Better speed increases	

responsibility
Fewer commits (authors) per single build
vs.
The Quality Follows
But that's still bad
We want CI feedback loop in a few minutes maximum
Splitting The Codebase
Inevitable Split - Fears
• Organizational concerns - understanding,
managing, integrating, releasing	

• Mindset change - if something worked for
10+ years why to change it?	

• Trust - does this library still work?	

• We damned ourselves with big buckets for
all tests - where do they belong to?
Splitting code base
• Step 0 - JIRA Importers Plugin (3.5 years ago)	

• Step 1- New IssueView and Navigator	

• Step 2 - now everything else follows JIRA 6.0
We are still escaping hell.
Hell sucks in your soul.
Conclusions
• Visibility and problem awareness help	

• Maintaing huge testbed is difficult and costly	

• Measure the problem - to baseline	

• No prejudice - no sacred cows	

• Automated tests are not one-off investment,
it's a continuous journey	

• Performance is a damn important feature
Test performance 	

is a damn important
feature!
XP vs Sad Reality
CostofChange
Time
Waterfall
XP - ideal
Sad Reality
Interested in such stuff?
http://www.spartez.com/careers
We are hiring in Gdańsk
• Turtle - by Jonathan Zander, CC-BY-SA-3.0	

• Loading - by MatthewJ13, CC-SA-3.0	

• Magic Potion - by Koolmann1, CC-BY-SA-2.0	

• Merlin Tool - by By L. Mahin, CC-BY-SA-3.0	

• Choose Pills - by *rockysprings, CC-BY-SA-3.0	

• Flashing Red Light - by Chris Phan, CC BY 2.0	

• Frustration - http://www.flickr.com/photos/striatic	

• Broken window - http://www.flickr.com/photos/leeadlaf/
Images - Credits
ThankYou!

Contenu connexe

Tendances

JDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsJDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsWojciech Seliga
 
Class 6: Introduction to web technology entrepreneurship
Class 6: Introduction to web technology entrepreneurshipClass 6: Introduction to web technology entrepreneurship
Class 6: Introduction to web technology entrepreneurshipallanchao
 
Class 7: Introduction to web technology entrepreneurship
Class 7: Introduction to web technology entrepreneurshipClass 7: Introduction to web technology entrepreneurship
Class 7: Introduction to web technology entrepreneurshipallanchao
 
Friday final test
Friday final testFriday final test
Friday final testbcoder
 
10 Big Ideas from Industry
10 Big Ideas from Industry10 Big Ideas from Industry
10 Big Ideas from IndustryGarth Gilmour
 
How good is your software development team ?
How good is your software development team ?How good is your software development team ?
How good is your software development team ?Kinshuk Adhikary
 
Rethinking Enterprise Software - Brandolini
Rethinking Enterprise Software - BrandoliniRethinking Enterprise Software - Brandolini
Rethinking Enterprise Software - BrandoliniCodemotion
 
OSDC 2019 | Feature Branching considered Evil by Thierry de Pauw
OSDC 2019 | Feature Branching considered Evil by Thierry de PauwOSDC 2019 | Feature Branching considered Evil by Thierry de Pauw
OSDC 2019 | Feature Branching considered Evil by Thierry de PauwNETWAYS
 
The Technical Debt Trap - Michael "Doc" Norton
The Technical Debt Trap - Michael "Doc" NortonThe Technical Debt Trap - Michael "Doc" Norton
The Technical Debt Trap - Michael "Doc" NortonLeanDog
 
"Our BDDs are broken!" Lean Agile Exchange 2020
"Our BDDs are broken!"   Lean Agile Exchange 2020"Our BDDs are broken!"   Lean Agile Exchange 2020
"Our BDDs are broken!" Lean Agile Exchange 2020Seb Rose
 
Are BDD and test automation the same thing? Automation Guild 2021
Are BDD and test automation the same thing?   Automation Guild 2021Are BDD and test automation the same thing?   Automation Guild 2021
Are BDD and test automation the same thing? Automation Guild 2021Seb Rose
 
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksTop Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksZeroTurnaround
 
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017Carol Smith
 

Tendances (19)

JDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile TeamsJDD Effective Code Review In Agile Teams
JDD Effective Code Review In Agile Teams
 
Class 6: Introduction to web technology entrepreneurship
Class 6: Introduction to web technology entrepreneurshipClass 6: Introduction to web technology entrepreneurship
Class 6: Introduction to web technology entrepreneurship
 
Class 7: Introduction to web technology entrepreneurship
Class 7: Introduction to web technology entrepreneurshipClass 7: Introduction to web technology entrepreneurship
Class 7: Introduction to web technology entrepreneurship
 
Friday final test
Friday final testFriday final test
Friday final test
 
Architects and design-org
Architects and design-orgArchitects and design-org
Architects and design-org
 
10 Big Ideas from Industry
10 Big Ideas from Industry10 Big Ideas from Industry
10 Big Ideas from Industry
 
How good is your software development team ?
How good is your software development team ?How good is your software development team ?
How good is your software development team ?
 
Rethinking Enterprise Software - Brandolini
Rethinking Enterprise Software - BrandoliniRethinking Enterprise Software - Brandolini
Rethinking Enterprise Software - Brandolini
 
OSDC 2019 | Feature Branching considered Evil by Thierry de Pauw
OSDC 2019 | Feature Branching considered Evil by Thierry de PauwOSDC 2019 | Feature Branching considered Evil by Thierry de Pauw
OSDC 2019 | Feature Branching considered Evil by Thierry de Pauw
 
The Technical Debt Trap - Michael "Doc" Norton
The Technical Debt Trap - Michael "Doc" NortonThe Technical Debt Trap - Michael "Doc" Norton
The Technical Debt Trap - Michael "Doc" Norton
 
Plugin style EA
Plugin style EAPlugin style EA
Plugin style EA
 
"Our BDDs are broken!" Lean Agile Exchange 2020
"Our BDDs are broken!"   Lean Agile Exchange 2020"Our BDDs are broken!"   Lean Agile Exchange 2020
"Our BDDs are broken!" Lean Agile Exchange 2020
 
Accessibility for beginners
Accessibility for beginnersAccessibility for beginners
Accessibility for beginners
 
Are BDD and test automation the same thing? Automation Guild 2021
Are BDD and test automation the same thing?   Automation Guild 2021Are BDD and test automation the same thing?   Automation Guild 2021
Are BDD and test automation the same thing? Automation Guild 2021
 
Biz Product Learnings
Biz Product LearningsBiz Product Learnings
Biz Product Learnings
 
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksTop Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
 
Smart Housekeeping Apps
Smart Housekeeping AppsSmart Housekeeping Apps
Smart Housekeeping Apps
 
Os Long
Os LongOs Long
Os Long
 
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017
Making Great User Experiences, Pittsburgh Scrum MeetUp, Oct 17, 2017
 

En vedette

How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)Wojciech Seliga
 
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKitAtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKitWojciech Seliga
 
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]Wojciech Seliga
 
Software Development Innovation in Practice - 33rd Degree 2014
Software Development Innovation in Practice - 33rd Degree 2014Software Development Innovation in Practice - 33rd Degree 2014
Software Development Innovation in Practice - 33rd Degree 2014Wojciech Seliga
 
Spartez Open Day March 13th 2015
Spartez Open Day March 13th 2015Spartez Open Day March 13th 2015
Spartez Open Day March 13th 2015Wojciech Seliga
 
Innowacja w praktyce - Infoshare 2014
Innowacja w praktyce - Infoshare 2014Innowacja w praktyce - Infoshare 2014
Innowacja w praktyce - Infoshare 2014Wojciech Seliga
 
Escaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year LaterEscaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year LaterWojciech Seliga
 
Developer plantations - colonialism of XXI century (GeeCON 2017)
Developer plantations - colonialism of XXI century (GeeCON 2017)Developer plantations - colonialism of XXI century (GeeCON 2017)
Developer plantations - colonialism of XXI century (GeeCON 2017)Wojciech Seliga
 

En vedette (9)

How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
 
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKitAtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
 
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
 
Software Development Innovation in Practice - 33rd Degree 2014
Software Development Innovation in Practice - 33rd Degree 2014Software Development Innovation in Practice - 33rd Degree 2014
Software Development Innovation in Practice - 33rd Degree 2014
 
Spartez Open Day March 13th 2015
Spartez Open Day March 13th 2015Spartez Open Day March 13th 2015
Spartez Open Day March 13th 2015
 
Innowacja w praktyce - Infoshare 2014
Innowacja w praktyce - Infoshare 2014Innowacja w praktyce - Infoshare 2014
Innowacja w praktyce - Infoshare 2014
 
Social Hacking
Social HackingSocial Hacking
Social Hacking
 
Escaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year LaterEscaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year Later
 
Developer plantations - colonialism of XXI century (GeeCON 2017)
Developer plantations - colonialism of XXI century (GeeCON 2017)Developer plantations - colonialism of XXI century (GeeCON 2017)
Developer plantations - colonialism of XXI century (GeeCON 2017)
 

Similaire à Automated Test Hell to Test Heaven

Heavenly hell – automated tests at scale wojciech seliga
Heavenly hell – automated tests at scale   wojciech seligaHeavenly hell – automated tests at scale   wojciech seliga
Heavenly hell – automated tests at scale wojciech seligaAtlassian
 
Escaping Test Hell - Our Journey - XPDays Ukraine 2013
Escaping Test Hell - Our Journey - XPDays Ukraine 2013Escaping Test Hell - Our Journey - XPDays Ukraine 2013
Escaping Test Hell - Our Journey - XPDays Ukraine 2013Wojciech Seliga
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Comprehensive Performance Testing: From Early Dev to Live Production
Comprehensive Performance Testing: From Early Dev to Live ProductionComprehensive Performance Testing: From Early Dev to Live Production
Comprehensive Performance Testing: From Early Dev to Live ProductionTechWell
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemYi-Ting Cheng
 
selenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scaleselenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at ScaleDavid Louvton
 
Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Sauce Labs
 
Continuous Integration on AWS
Continuous Integration on AWSContinuous Integration on AWS
Continuous Integration on AWSPetar Petrov
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchExcella
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Niels Frydenholm
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Applitools
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!Ortus Solutions, Corp
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIwajrcs
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 

Similaire à Automated Test Hell to Test Heaven (20)

Heavenly hell – automated tests at scale wojciech seliga
Heavenly hell – automated tests at scale   wojciech seligaHeavenly hell – automated tests at scale   wojciech seliga
Heavenly hell – automated tests at scale wojciech seliga
 
Escaping Test Hell - Our Journey - XPDays Ukraine 2013
Escaping Test Hell - Our Journey - XPDays Ukraine 2013Escaping Test Hell - Our Journey - XPDays Ukraine 2013
Escaping Test Hell - Our Journey - XPDays Ukraine 2013
 
33rd degree
33rd degree33rd degree
33rd degree
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Comprehensive Performance Testing: From Early Dev to Live Production
Comprehensive Performance Testing: From Early Dev to Live ProductionComprehensive Performance Testing: From Early Dev to Live Production
Comprehensive Performance Testing: From Early Dev to Live Production
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails Ecosystem
 
selenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scaleselenium meetup sf talk march 2014 Selenium at Scale
selenium meetup sf talk march 2014 Selenium at Scale
 
Selenium at Salesforce Scale
Selenium at Salesforce ScaleSelenium at Salesforce Scale
Selenium at Salesforce Scale
 
Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014Salesforce selenium-saucelabs-webinar-april-2014
Salesforce selenium-saucelabs-webinar-april-2014
 
Continuous Integration on AWS
Continuous Integration on AWSContinuous Integration on AWS
Continuous Integration on AWS
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
Selenium practical
Selenium practicalSelenium practical
Selenium practical
 

Dernier

multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfNainaShrivastava14
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Romil Mishra
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 

Dernier (20)

multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________Gravity concentration_MI20612MI_________
Gravity concentration_MI20612MI_________
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 

Automated Test Hell to Test Heaven

  • 1. Automated Test Hell Wojciech Seliga wojciech.seliga@spartez.com, @wseliga or There and Back Again
  • 2. About me • Coding since 6yo • Former C++ developer (’90s, early ’00s) • Agile Practices (inc.TDD) since 2003 • Dev Nerd,Tech Leader, Agile Coach, Speaker, PHB • 6.5 years with Atlassian (JIRA Dev Manager) • Spartez Co-founder & CEO
  • 8. Almost 10 years of accumulating garbage automatic tests
  • 9. 18 000 tests* on all levels 13 000 unit tests *excluding tests of the libraries 4 000 func and integration tests 1 000 Selenium tests
  • 12. Test frameworks • JUnit 3 and 4 • JMock, Easymock, Mockito • Powermock, Hamcrest • QUnit, HTMLUnit, Jasmine.js, Sinon.js • JWebUnit, Selenium, WebDriver • Custom runners
  • 13. Bamboo Setup • Dedicated server with 70+ remote agents (including Amazon Elastic) • Build engineers • Bamboo devs on-site
  • 15. for each main branch
  • 16. Run in parallel in batches Run first
  • 18. Type of tests • Unit • Functional • Integration • Platform • Performance
  • 19. Platforms • Dimension - DB: MySQL, PostgreSQL, MS SQL, Oracle • Dimension - OS: Linux, Windows • Dimension - Java ver.: 1.5, 1.6, 1.7, 1.8 • Dimension - CPU arch.: 32-bit, 64-bit • Dimension - Deployment Mode: Standalone, Tomcat, Websphere, Weblogic Run Nightly Coming
  • 20. Triggering Builds • On Commit (hooks, polling) • Dependent Builds • Nightly Builds • Manual Builds
  • 21. Very slow (long hours) and fragile feedback loop
  • 23. It takes time to fix it...
  • 25. You commit at 3 PM You get “Unit Test Green” email at 4PM You get flood of “Red Test X” emails at 4 - 9PM Your colleagues on the other side of the globe You happily go home You
  • 26. “We probably spend more time dealing with the JIRA test codebase than the production codebase”
  • 30. Catching up with UI changes Page Objects Pattern Problem: Solution:
  • 31. Page Objects Pattern • Page Objects model UI elements (pages, components, dialogs, areas) your tests interact with • Page Objects shield tests from changing internal structure of the page • Page Objects generally do not make assertions about data. The can assert the state. • Designed for chaining
  • 32. Page Objects Example public class AddUserPage extends AbstractJiraPage! {! ! private static final String URI = ! "/secure/admin/user/AddUser!default.jspa";! ! @ElementBy(name = "username")! private PageElement username;! ! @ElementBy(name = "password")! private PageElement password;! ! @ElementBy(name = "confirm")! private PageElement passwordConfirmation;! ! @ElementBy(name = "fullname")! private PageElement fullName;! ! @ElementBy(name = "email")! private PageElement email;! ! @ElementBy(name = "sendemail")! private PageElement sendEmail;! ! @ElementBy(id = "user-create-submit")! private PageElement submit;! ! @ElementBy (id = "user-create-cancel")! private PageElement cancelButton;! ! @Override! public String getUrl()! {! return URI;! }! ... @Override! public TimedCondition isAt()! {! return and(username.timed().isPresent(), ! password.timed().isPresent(), fullName.timed().isPresent());! }! ! public AddUserPage addUser(final String username, ! final String password, final String fullName, final String email, final boolean receiveEmail)! {! this.username.type(username);! this.password.type(password);! this.passwordConfirmation.type(password);! this.fullName.type(fullName);! this.email.type(email);! if(receiveEmail) {! this.sendEmail.select();! }! return this;! }! ! public ViewUserPage createUser()! {! return createUser(ViewUserPage.class);! }! ! ! public <T extends Page> T createUser(Class<T> nextPage, Object...args)! {! submit.click();! return pageBinder.bind(nextPage, args);! }!
  • 33. Using Page Objects @Test! public void testServerError()! {! jira.gotoLoginPage().loginAsSysAdmin(AddUserPage.class)! .addUser("username", "mypassword", "My Name",! "sample@email.com", false)! .createUser();! // assertions here! }!
  • 34. Opaque Test Fixtures REST-based Set-up Problem: Solution:
  • 35. REST-based Setup @Before! public void setUpTest() {! restore("some-big-xml-file-with-everything-needed-inside.xml");! }! @Before! public void setUpTest() {! restClient.restoreEmptyInstance();! restClient.createProject(/* project params */);! restClient.createUser(/* user params */);! restClient.createUser(/* user params */);! restClient.createSomethingElse(/* ... */);! }! VS
  • 36. Flakey Tests Timed Conditions Problem: Solution: Mock Unreliable Deps Test-friendly Markup
  • 38. Quarantine • @Ignore • @Category • Quarantine on CI server • Recover or Die
  • 39. Non-deterministic tests are strong inhibitor of change instead of the catalyst
  • 40. Execution Time: Test Level Unit Tests REST API Tests JWebUnit/HTMLUnit Tests Selenium/WebDriver Tests Speed Confidence
  • 41. Our example: Front-end-heavy web app 100 WebDriver tests: 100 QUnit tests: 15 minutes 1.2 seconds
  • 42. Test Pyramid Unit Tests (including JS tests) REST / HTML Tests Selenium Good!
  • 43. Test Code is Not Trash Design Maintain Refactor Share Review Prune Respect Discuss Restructure
  • 44. Optimum Balance Isolation Speed Coverage Level Access Effort
  • 45. Dangerous to temper with MaintainabilityQuality / Determinism
  • 47. People - Motivation Making GREEN the norm
  • 50. Build Tiers and Policy Tier A1 - green soon after all commits Tier A2 - green at the end of the day Tier A3 - green at the end of the iteration unit tests and functional* tests WebDriver and bundled plugins tests supported platforms tests, compatibility tests
  • 52. Training • assertThat over assertTrue/False and assertEquals • avoiding races - Atlassian Selenium with its TimedElement • Favouring unit tests over functional tests • Promoting Page Objects • Brownbags, blog posts, code reviews
  • 54. Automatic Flakiness Detection Quarantine Re-run failed tests and see if they pass
  • 59. Ditching - benefits • Freed build agents - better system throughput • Boosted morale • Gazillion of developer hours saved • Money saved on infrastructure
  • 60. Ditching - due diligence • conducting the audit - analysis of the coverage we lost • determining which tests needs to rewritten (e.g. security related) • rewriting the tests (good job for new hires + a senior mentor)
  • 61. Flaky Browser-based Tests Races between test code and asynchronous page logic Playing with "loading" CSS class does not really help
  • 62. Races Removal with Tracing // in the browser:! function mySearchClickHandler() {!     doSomeXhr().always(function() {!         // This executes when the XHR has completed (either success or failure)!         JIRA.trace("search.completed");"     });! }! // In production code JIRA.trace is a no-op // in my page object:! @Inject! TraceContext traceContext;!  ! public SearchResults doASearch() {!     Tracer snapshot = traceContext.checkpoint();!     getSearchButton().click(); // causes mySearchClickHandler to be invoked!     // This waits until the "search.completed"
 // event has been emitted, *after* previous snapshot    !     traceContext.waitFor(snapshot, "search.completed"); !     return pageBinder.bind(SearchResults.class);! }!
  • 63. Can we halve our build times? Speed
  • 64. Parallel Execution - Theory End of Build Batches Start of Build
  • 65. Parallel Execution End of Build Batches Start of Build
  • 66. Parallel Execution - Reality Bites End of Build Batches Start of Build Agent availability
  • 68. "You can't manage what you can't measure." not by W. Edwards Deming If you believe just in it you are doomed.
  • 69. You can't improve something if you can't measure it Profiler, Build statistics, Logs, statsd → Graphite
  • 70. Anatomy of Build* Compilation Packaging Executing Tests Fetching Dependencies *Any resemblance to maven build is entirely accidental SCM Update Agent Availability/Setup Publishing Results
  • 71. JIRA Unit Tests Build Compilation (7min) Packaging (0min) Executing Tests (7min) Fetching Dependencies (1.5min) SCM Update (2min) Agent Availability/Setup (mean 10min) Publishing Results (1min)
  • 72. Decreasing Test Execution Time to ZERRO alone would not let us achieve our goal!
  • 73. Agent Availability/Setup • starved builds due to busy agents building very long builds • time synchronization issue - NTPD problem
  • 74. • Proximity of SCM repo • shallow git clones are not so fast and lightweight + generating extra git server CPU load • git clone per agent/plan + git pull + git clone per build (hard links!) • Stash was thankful (queue) SCM Update - Checkout time 2 min → 5 seconds
  • 75.
  • 76. • Fix Predator • Sandboxing/isolation agent trade-off:
 rm -rf $HOME/.m2/repository/com/atlassian/*
 into
 find $HOME/.m2/repository/com/atlassian/ 
 -name “*SNAPSHOT*” | xargs rm • Network hardware failure found (dropping packets) Fetching Dependencies 1.5 min → 10 seconds
  • 77. Compilation • Restructuring multi-pom maven project and dependencies • Maven 3 parallel compilation FTW
 
 -T 1.5C
 *optimal factor thanks to scientific trial and error research
 7 min → 1 min
  • 78. Unit Test Execution • Splitting unit tests into 2 buckets: good and legacy (much longer) • Maven 3 parallel test execution (-T 1.5C) 7 min → 5 min 3000 poor tests (5min) 11000 good tests (1.5min)
  • 79. Functional Tests • Selenium 1 removal did help • Faster reset/restore (avoid unnecessary stuff, intercepting SQL operations for debug purposes - building stacktraces is costly) • Restoring via Backdoor REST API • Using REST API for common setup/ teardown operations
  • 81. Publishing Results • Server log allocation per test → using now Backdoor REST API (was Selenium) • Bamboo DB performance degradation for rich build history - to be addressed 1 min → 40 s
  • 82. Unexpected Problem • Stability Issues with our CI server • The bottleneck changed from I/O to CPU • Too many agents per physical machine
  • 83. JIRA Unit Tests Build Improved Compilation (1min) Packaging (0min) Executing Tests (5min) Fetching Dependencies (10sec) SCM Update (5sec) Agent Availability/Setup (3min)* Publishing Results (40sec)
  • 84. Improvements Summary Tests Before After Improvement % Unit tests 29 min 17 min 41% Functional tests 56 min 34 min 39% WebDriver tests 39 min 21 min 46% Overall 124 min 72 min 42% * Additional ca. 5% improvement expected once new git clone strategy is consistently rolled-out everywhere
  • 85. Better speed increases responsibility Fewer commits (authors) per single build vs.
  • 87. But that's still bad We want CI feedback loop in a few minutes maximum
  • 89. Inevitable Split - Fears • Organizational concerns - understanding, managing, integrating, releasing • Mindset change - if something worked for 10+ years why to change it? • Trust - does this library still work? • We damned ourselves with big buckets for all tests - where do they belong to?
  • 90. Splitting code base • Step 0 - JIRA Importers Plugin (3.5 years ago) • Step 1- New IssueView and Navigator • Step 2 - now everything else follows JIRA 6.0
  • 91. We are still escaping hell. Hell sucks in your soul.
  • 92. Conclusions • Visibility and problem awareness help • Maintaing huge testbed is difficult and costly • Measure the problem - to baseline • No prejudice - no sacred cows • Automated tests are not one-off investment, it's a continuous journey • Performance is a damn important feature
  • 93. Test performance is a damn important feature!
  • 94. XP vs Sad Reality CostofChange Time Waterfall XP - ideal Sad Reality
  • 95. Interested in such stuff? http://www.spartez.com/careers We are hiring in Gdańsk
  • 96. • Turtle - by Jonathan Zander, CC-BY-SA-3.0 • Loading - by MatthewJ13, CC-SA-3.0 • Magic Potion - by Koolmann1, CC-BY-SA-2.0 • Merlin Tool - by By L. Mahin, CC-BY-SA-3.0 • Choose Pills - by *rockysprings, CC-BY-SA-3.0 • Flashing Red Light - by Chris Phan, CC BY 2.0 • Frustration - http://www.flickr.com/photos/striatic • Broken window - http://www.flickr.com/photos/leeadlaf/ Images - Credits