SlideShare a Scribd company logo
Main sponsor




Escaping Automated Test Hell
        One year later...

        Wojciech Seliga
About me
• Coding for 30 years
• Agile Practices (inc. TDD) since 2003
• Dev Nerd, Tech Leader, Agile Coach,
  Speaker
• 5+ years with Atlassian (JIRA Development
  Team Lead)
• Spartez Co-founder
Year ago - recap
18 000 tests on all levels

 Very slow and fragile
    feedback loop
Serious performance and
    reliability issues
Feedback        Test
 Speed         Quality
           `
Respect   Restructure
Design           Share
         Prune

   Test Code is Not
        Trash
Refactor
                 Maintain
       Review
                Discuss
Optimum Balance
Optimum Balance




Isolation
Optimum Balance




Isolation Speed
Optimum Balance




Isolation Speed Coverage
Optimum Balance




Isolation Speed Coverage Level
Optimum Balance




Isolation Speed Coverage Level   Access
Optimum Balance




Isolation Speed Coverage Level   Access   Effort
Dangerous to temper with
Dangerous to temper with




Quality / Determinism
Dangerous to temper with




Quality / Determinism   Maintainability
Splitting codebase is
 key aspect of short
 test feedback loop
Now
People - Motivation
Shades of Red
Pragmatic CI Health
Build Tiers and Policy

Tier A1 - green soon after all commits
         unit tests and functional* tests

Tier A2 - green at the end of the day
      WebDriver and bundled plugins tests

Tier A3 - green at the end of the iteration
  supported platforms tests, compatibility tests
Wallboards:
 Constant
Awareness
Training
• assertThat over assertTrue/False and
  assertEquals
• avoiding races - Atlassian Selenium with its
  TimedElement
• Unit tests over functional tests
• Brownbags, blogs, code reviews
Quality
Re-run failed tests and see if they pass




Automatic Flakiness Detection
        Quarantine
Quarantine - Healing
SlowMo - expose races
Selenium 1
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
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);
}
Speed
Speed




Can we halve our build times?
Parallel Execution - Theory
    Batches




Start of Build   End of Build
Parallel Execution
    Batches




Start of Build          End of Build
Parallel Execution -
  Agent
availability
               Reality Bites
      Batches




  Start of Build              End of Build
Dynamic Test Execution
 Dispatch - Hallelujah
Dynamic Test Execution
 Dispatch - Hallelujah
"You can't manage what
  you can't measure."
             W. Edwards Deming
If y
    ou
  you   bel
            ieve
   "Youare manage what
        can't    just
            doo        i i
     you can't measure."n
                 me        t
                    d.
                 W. Edwards Deming
You can't improve something
   if you can't measure it
You can't improve something
   if you can't measure it
  Profiler, Build statistics, Logs, statsd → Graphite
Compilation
        Packaging




           Executing Tests


Anatomy of Build*
Fetching Dependencies
       Compilation
             Packaging




               Executing Tests


 Anatomy of Build*
Fetching Dependencies
       Compilation
             Packaging




                           Executing Tests


 Anatomy of Build*
    *Any resemblance to maven build is entirely accidental
Fetching Dependencies
          Compilation
                Packaging




SCM Update                    Executing Tests


    Anatomy of Build*
       *Any resemblance to maven build is entirely accidental
Agent Availability/Setup
        Fetching Dependencies
                  Compilation
                         Packaging




    SCM Update                       Executing Tests


          Anatomy of Build*
              *Any resemblance to maven build is entirely accidental
Agent Availability/Setup
        Fetching Dependencies
                  Compilation
                         Packaging                            Publishing Results




    SCM Update                       Executing Tests


          Anatomy of Build*
              *Any resemblance to maven build is entirely accidental
Compilation (7min)




JIRA Unit Tests Build
Compilation (7min)

                 Packaging (0min)




JIRA Unit Tests Build
Compilation (7min)

                 Packaging (0min)




                   Executing Tests (7min)



JIRA Unit Tests Build
Compilation (7min)
                   Publishing Results (1min)
                  Packaging (0min)




                    Executing Tests (7min)



JIRA Unit Tests Build
Compilation (7min)
                   Publishing Results (1min)
                  Packaging (0min)




                   Executing Tests (7min)
   Fetching Dependencies (1.5min)

JIRA Unit Tests Build
Compilation (7min)
                       Publishing Results (1min)
SCM Update (2min)     Packaging (0min)




                         Executing Tests (7min)
         Fetching Dependencies (1.5min)

   JIRA Unit Tests Build
Agent Availability/Setup (mean 10min)
               Compilation (7min)
                                Publishing Results (1min)
   SCM Update (2min)           Packaging (0min)




                              Executing Tests (7min)
              Fetching Dependencies (1.5min)

       JIRA Unit Tests Build
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
SCM Update - Checkout time

•   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

•   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)

        2 min → 5 seconds
Escaping Automated Test Hell - One Year Later
Fetching Dependencies
• 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
• 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)

     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
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)
3000 poor tests                  11000 good tests
    (5min)                           (1.5min)
Unit Test Execution
   • Splitting unit tests into 2 buckets: good and
     legacy (much longer)
   • Maven 3 parallel test execution (-T 1.5C)
3000 poor tests                  11000 good tests
    (5min)                           (1.5min)


          7 min → 5 min
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
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
Compilation (1min)




JIRA Unit Tests Build Improved
Compilation (1min)
               Packaging (0min)




JIRA Unit Tests Build Improved
Compilation (1min)
               Packaging (0min)




                Executing Tests (5min)



JIRA Unit Tests Build Improved
Compilation (1min)
               Packaging (0min)
                  Publishing Results (40sec)




                Executing Tests (5min)



JIRA Unit Tests Build Improved
Compilation (1min)
                      Packaging (0min)
                         Publishing Results (40sec)




                        Executing Tests (5min)
Fetching Dependencies (10sec)

JIRA Unit Tests Build Improved
Compilation (1min)
                      Packaging (0min)
                         Publishing Results (40sec)




SCM Update (5sec)       Executing Tests (5min)
Fetching Dependencies (10sec)

JIRA Unit Tests Build Improved
Agent Availability/Setup (3min)*
                   Compilation (1min)
                      Packaging (0min)
                         Publishing Results (40sec)




SCM Update (5sec)       Executing Tests (5min)
Fetching Dependencies (10sec)

JIRA Unit Tests Build Improved
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
The Quality Follows
The Quality Follows
The Quality Follows
But that's still bad




We want CI feedback loop in a few minutes maximum
Splitting The Codebase
Resistance against splitting
   The last attempt: Magic Machine




Decide with high confidence (e.g. > 95%) which subset of tests
          to run basing on the committed changes
Magic Machine
• Looking at Bamboo history (analysing
  correlation between changes and failures)
• Matching: package test/prod code and
  transitive imports
• Code instrumentation (Clover, Emma, AspectJ)
• Run most often failing first
Inevitable Split - Fears

• Organizational concerns - understanding,
  managing, integrating, releasing
• Mindset change - if something worked for
  10 years why to change it?
• We damned ourselves with big buckets for
  all tests - where do they belong to?
Magic Machine strikes back




   With heavy use of brain, common sense
           and expert judgement
Splitting code base
• Step 0 - JIRA Importers Plugin (3 years ago)
• Step 1- New Issue View and Navigator
                                         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
• No prejudice - no sacred cows
• Automated tests are not one-off investment,
  it's a continuous journey
• Performance is a damn important feature
Do you want to help?
We are hiring in Gdańsk
•   Principal Java Developer

•   Development Team Lead

•   Java and Scala Developers

•   UX Designer

•   Front-End Developer

•   QA Engineer
          Visit us at the booth or apply at
    http://www.atlassian.com/company/careers
Images - Credits

• 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
Thank You!

More Related Content

PDF
Monster Builds and How to Tame Them - Atlassian Summit 2010
KEY
Massively Continuous Integration: From 3 days to 30 minutes
PPTX
Beyond Scrum: Scaling Agile with Continuous Delivery and Subversion
KEY
Beyond TDD: Enabling Your Team to Continuously Deliver Software
PPTX
Continuous Delivery in the real world - techniques to reduce the developers b...
PPTX
Test Driven Development & CI/CD
PPTX
Leandro Melendez - Switching Performance Left & Right
PDF
Continuous Deployment: Beyond Continuous Delivery
Monster Builds and How to Tame Them - Atlassian Summit 2010
Massively Continuous Integration: From 3 days to 30 minutes
Beyond Scrum: Scaling Agile with Continuous Delivery and Subversion
Beyond TDD: Enabling Your Team to Continuously Deliver Software
Continuous Delivery in the real world - techniques to reduce the developers b...
Test Driven Development & CI/CD
Leandro Melendez - Switching Performance Left & Right
Continuous Deployment: Beyond Continuous Delivery

What's hot (20)

PDF
Tests antipatterns
PPTX
Linuxtag 2012 - continuous delivery - dream to reality
PDF
Releasing To Production Every Week India
PPTX
Scaling Up Continuous Deployment
PDF
Real Java EE Testing with Arquillian and ShrinkWrap
PPTX
Continuous delivery chernivcy
PDF
Arquillian : An introduction
PDF
Live Testing A Legacy App
PDF
Sista: Improving Cog’s JIT performance
PPTX
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
PPTX
Arquillian
PPTX
Continuous integration
PDF
[123] quality without qa
PDF
Delivering Microservices Using Docker
PDF
Comprehensive Performance Testing: From Early Dev to Live Production
PPTX
The Hard Problems of Continuous Deployment
PDF
September 2010 - Arquillian
PPTX
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: Software Testing wit...
PDF
Continuous delivery @wcap 5-09-2013
PPSX
Test Bench Development
Tests antipatterns
Linuxtag 2012 - continuous delivery - dream to reality
Releasing To Production Every Week India
Scaling Up Continuous Deployment
Real Java EE Testing with Arquillian and ShrinkWrap
Continuous delivery chernivcy
Arquillian : An introduction
Live Testing A Legacy App
Sista: Improving Cog’s JIT performance
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Arquillian
Continuous integration
[123] quality without qa
Delivering Microservices Using Docker
Comprehensive Performance Testing: From Early Dev to Live Production
The Hard Problems of Continuous Deployment
September 2010 - Arquillian
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: Software Testing wit...
Continuous delivery @wcap 5-09-2013
Test Bench Development
Ad

Viewers also liked (15)

PDF
Spartez Open Day March 13th 2015
PDF
Developer plantations - colonialism of XXI century (GeeCON 2017)
PDF
Social Hacking
PDF
Escaping Test Hell - ACCU 2014
PDF
Ten lessons I painfully learnt while moving from software developer
to entrep...
PDF
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
PDF
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
PDF
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
PDF
Software Developer Career Unplugged - GeeCon 2013
PDF
Innowacja w praktyce - Infoshare 2014
PDF
10 bezcennych lekcji dla software developera stającego się szefem firmy
PDF
5-10-15 years of Java developer career - Warszawa JUG 2015
PDF
SFI 2017 Plantacje Programistów (Developers Plantations) - Colonialism in XXI...
PDF
Software Development Innovation in Practice - 33rd Degree 2014
PDF
Ten lessons I painfully learnt while moving from software developer to entrep...
Spartez Open Day March 13th 2015
Developer plantations - colonialism of XXI century (GeeCON 2017)
Social Hacking
Escaping Test Hell - ACCU 2014
Ten lessons I painfully learnt while moving from software developer
to entrep...
InfoShare 2012 efektywne przeglądy kodu w zespołach agile [Polish]
AtlasCamp 2012 - Testing JIRA plugins smarter with TestKit
How to be Awesome at a Java Developer Job Interview (Confitura 2012, Polish)
Software Developer Career Unplugged - GeeCon 2013
Innowacja w praktyce - Infoshare 2014
10 bezcennych lekcji dla software developera stającego się szefem firmy
5-10-15 years of Java developer career - Warszawa JUG 2015
SFI 2017 Plantacje Programistów (Developers Plantations) - Colonialism in XXI...
Software Development Innovation in Practice - 33rd Degree 2014
Ten lessons I painfully learnt while moving from software developer to entrep...
Ad

Similar to Escaping Automated Test Hell - One Year Later (20)

PDF
Heavenly hell – automated tests at scale wojciech seliga
PDF
Escaping Test Hell - Our Journey - XPDays Ukraine 2013
KEY
33rd degree
ZIP
Introduction To Continuous Integration
PPTX
Agile Engineering Sparker GLASScon 2015
PPTX
Continuous Test Automation via CI (CodeMash 2012) - Automating the Agile way
PDF
Planning & building scalable test infrastructure
PDF
Continuous integration (eng)
PDF
Agile Engineering Best Practices by Richard Cheng
PPT
Extreme CI Savings with Bamboo 3.1: The JIRA Story
PPTX
(Agile) engineering best practices - What every project manager should know
PDF
Enabling Agile Testing Through Continuous Integration Agile2009
PPT
DevOps / Agile Tools Seminar 2013
PDF
Survival of the Continuist
PDF
Continuous Testing
PDF
How the JDeveloper team test JDeveloper at UKOUG'08
PDF
DPE Summit - A More Integrated Build and CI to Accelerate Builds at Netflix
PPTX
Tuenti Release Workflow
PPTX
Operations Support Workflow - Rundeck
PPT
Evergreen build
Heavenly hell – automated tests at scale wojciech seliga
Escaping Test Hell - Our Journey - XPDays Ukraine 2013
33rd degree
Introduction To Continuous Integration
Agile Engineering Sparker GLASScon 2015
Continuous Test Automation via CI (CodeMash 2012) - Automating the Agile way
Planning & building scalable test infrastructure
Continuous integration (eng)
Agile Engineering Best Practices by Richard Cheng
Extreme CI Savings with Bamboo 3.1: The JIRA Story
(Agile) engineering best practices - What every project manager should know
Enabling Agile Testing Through Continuous Integration Agile2009
DevOps / Agile Tools Seminar 2013
Survival of the Continuist
Continuous Testing
How the JDeveloper team test JDeveloper at UKOUG'08
DPE Summit - A More Integrated Build and CI to Accelerate Builds at Netflix
Tuenti Release Workflow
Operations Support Workflow - Rundeck
Evergreen build

More from Wojciech Seliga (8)

PDF
Sprzedawanie własnego biznesu IT - Confitura 2023.pdf
PDF
Jak być zarąbistym developerem w oczach szefa i ... klienta
PDF
How to impress your boss and your customer in a modern software development c...
PDF
Devoxx Poland 2015: 5-10-15 years with Java
PDF
Confitura 2013 Software Developer Career Unplugged
KEY
Better Front-end Development in Atlassian Plugins
ODP
Bringing Effectiveness and Sanity to Highly Distributed Agile Teams
PDF
JDD Effective Code Review In Agile Teams
Sprzedawanie własnego biznesu IT - Confitura 2023.pdf
Jak być zarąbistym developerem w oczach szefa i ... klienta
How to impress your boss and your customer in a modern software development c...
Devoxx Poland 2015: 5-10-15 years with Java
Confitura 2013 Software Developer Career Unplugged
Better Front-end Development in Atlassian Plugins
Bringing Effectiveness and Sanity to Highly Distributed Agile Teams
JDD Effective Code Review In Agile Teams

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Mobile App Security Testing_ A Comprehensive Guide.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Monthly Chronicles - July 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

Escaping Automated Test Hell - One Year Later

  • 1. Main sponsor Escaping Automated Test Hell One year later... Wojciech Seliga
  • 2. About me • Coding for 30 years • Agile Practices (inc. TDD) since 2003 • Dev Nerd, Tech Leader, Agile Coach, Speaker • 5+ years with Atlassian (JIRA Development Team Lead) • Spartez Co-founder
  • 3. Year ago - recap
  • 4. 18 000 tests on all levels Very slow and fragile feedback loop
  • 5. Serious performance and reliability issues
  • 6. Feedback Test Speed Quality `
  • 7. Respect Restructure Design Share Prune Test Code is Not Trash Refactor Maintain Review Discuss
  • 13. Optimum Balance Isolation Speed Coverage Level Access
  • 14. Optimum Balance Isolation Speed Coverage Level Access Effort
  • 16. Dangerous to temper with Quality / Determinism
  • 17. Dangerous to temper with Quality / Determinism Maintainability
  • 18. Splitting codebase is key aspect of short test feedback loop
  • 19. Now
  • 23. Build Tiers and Policy Tier A1 - green soon after all commits unit tests and functional* tests Tier A2 - green at the end of the day WebDriver and bundled plugins tests Tier A3 - green at the end of the iteration supported platforms tests, compatibility tests
  • 25. Training • assertThat over assertTrue/False and assertEquals • avoiding races - Atlassian Selenium with its TimedElement • Unit tests over functional tests • Brownbags, blogs, code reviews
  • 27. Re-run failed tests and see if they pass Automatic Flakiness Detection Quarantine
  • 32. Selenium ditching Sky did not fall in
  • 33. Ditching - benefits • Freed build agents - better system throughput • Boosted morale • Gazillion of developer hours saved • Money saved on infrastructure
  • 34. 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
  • 35. Flaky Browser-based Tests Races between test code and asynchronous page logic Playing with "loading" CSS class does not really help
  • 36. 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); }
  • 37. Speed
  • 38. Speed Can we halve our build times?
  • 39. Parallel Execution - Theory Batches Start of Build End of Build
  • 40. Parallel Execution Batches Start of Build End of Build
  • 41. Parallel Execution - Agent availability Reality Bites Batches Start of Build End of Build
  • 42. Dynamic Test Execution Dispatch - Hallelujah
  • 43. Dynamic Test Execution Dispatch - Hallelujah
  • 44. "You can't manage what you can't measure." W. Edwards Deming
  • 45. If y ou you bel ieve "Youare manage what can't just doo i i you can't measure."n me t d. W. Edwards Deming
  • 46. You can't improve something if you can't measure it
  • 47. You can't improve something if you can't measure it Profiler, Build statistics, Logs, statsd → Graphite
  • 48. Compilation Packaging Executing Tests Anatomy of Build*
  • 49. Fetching Dependencies Compilation Packaging Executing Tests Anatomy of Build*
  • 50. Fetching Dependencies Compilation Packaging Executing Tests Anatomy of Build* *Any resemblance to maven build is entirely accidental
  • 51. Fetching Dependencies Compilation Packaging SCM Update Executing Tests Anatomy of Build* *Any resemblance to maven build is entirely accidental
  • 52. Agent Availability/Setup Fetching Dependencies Compilation Packaging SCM Update Executing Tests Anatomy of Build* *Any resemblance to maven build is entirely accidental
  • 53. Agent Availability/Setup Fetching Dependencies Compilation Packaging Publishing Results SCM Update Executing Tests Anatomy of Build* *Any resemblance to maven build is entirely accidental
  • 55. Compilation (7min) Packaging (0min) JIRA Unit Tests Build
  • 56. Compilation (7min) Packaging (0min) Executing Tests (7min) JIRA Unit Tests Build
  • 57. Compilation (7min) Publishing Results (1min) Packaging (0min) Executing Tests (7min) JIRA Unit Tests Build
  • 58. Compilation (7min) Publishing Results (1min) Packaging (0min) Executing Tests (7min) Fetching Dependencies (1.5min) JIRA Unit Tests Build
  • 59. Compilation (7min) Publishing Results (1min) SCM Update (2min) Packaging (0min) Executing Tests (7min) Fetching Dependencies (1.5min) JIRA Unit Tests Build
  • 60. Agent Availability/Setup (mean 10min) Compilation (7min) Publishing Results (1min) SCM Update (2min) Packaging (0min) Executing Tests (7min) Fetching Dependencies (1.5min) JIRA Unit Tests Build
  • 61. Decreasing Test Execution Time to ZERRO alone would not let us achieve our goal!
  • 62. Agent Availability/Setup • starved builds due to busy agents building very long builds • time synchronization issue - NTPD problem
  • 63. SCM Update - Checkout time • 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)
  • 64. SCM Update - Checkout time • 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) 2 min → 5 seconds
  • 66. Fetching Dependencies • 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)
  • 67. Fetching Dependencies • 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) 1.5 min → 10 seconds
  • 68. 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
  • 69. 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
  • 70. Unit Test Execution • Splitting unit tests into 2 buckets: good and legacy (much longer) • Maven 3 parallel test execution (-T 1.5C) 3000 poor tests 11000 good tests (5min) (1.5min)
  • 71. Unit Test Execution • Splitting unit tests into 2 buckets: good and legacy (much longer) • Maven 3 parallel test execution (-T 1.5C) 3000 poor tests 11000 good tests (5min) (1.5min) 7 min → 5 min
  • 72. 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
  • 74. 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
  • 75. 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
  • 76. Unexpected Problem • Stability Issues with our CI server • The bottleneck changed from I/O to CPU • Too many agents per physical machine
  • 77. Compilation (1min) JIRA Unit Tests Build Improved
  • 78. Compilation (1min) Packaging (0min) JIRA Unit Tests Build Improved
  • 79. Compilation (1min) Packaging (0min) Executing Tests (5min) JIRA Unit Tests Build Improved
  • 80. Compilation (1min) Packaging (0min) Publishing Results (40sec) Executing Tests (5min) JIRA Unit Tests Build Improved
  • 81. Compilation (1min) Packaging (0min) Publishing Results (40sec) Executing Tests (5min) Fetching Dependencies (10sec) JIRA Unit Tests Build Improved
  • 82. Compilation (1min) Packaging (0min) Publishing Results (40sec) SCM Update (5sec) Executing Tests (5min) Fetching Dependencies (10sec) JIRA Unit Tests Build Improved
  • 83. Agent Availability/Setup (3min)* Compilation (1min) Packaging (0min) Publishing Results (40sec) SCM Update (5sec) Executing Tests (5min) Fetching Dependencies (10sec) JIRA Unit Tests Build Improved
  • 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
  • 88. But that's still bad We want CI feedback loop in a few minutes maximum
  • 90. Resistance against splitting The last attempt: Magic Machine Decide with high confidence (e.g. > 95%) which subset of tests to run basing on the committed changes
  • 91. Magic Machine • Looking at Bamboo history (analysing correlation between changes and failures) • Matching: package test/prod code and transitive imports • Code instrumentation (Clover, Emma, AspectJ) • Run most often failing first
  • 92. Inevitable Split - Fears • Organizational concerns - understanding, managing, integrating, releasing • Mindset change - if something worked for 10 years why to change it? • We damned ourselves with big buckets for all tests - where do they belong to?
  • 93. Magic Machine strikes back With heavy use of brain, common sense and expert judgement
  • 94. Splitting code base • Step 0 - JIRA Importers Plugin (3 years ago) • Step 1- New Issue View and Navigator JIRA 6 .0
  • 95. We are still escaping hell. Hell sucks in your soul.
  • 96. Conclusions • Visibility and problem awareness help • Maintaing huge testbed is difficult and costly • Measure the problem • No prejudice - no sacred cows • Automated tests are not one-off investment, it's a continuous journey • Performance is a damn important feature
  • 97. Do you want to help? We are hiring in Gdańsk • Principal Java Developer • Development Team Lead • Java and Scala Developers • UX Designer • Front-End Developer • QA Engineer Visit us at the booth or apply at http://www.atlassian.com/company/careers
  • 98. Images - Credits • 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