SlideShare a Scribd company logo
1 of 20
WORKS IN (X, Y, Z)
Parallel Combination Testing With Selenium,
JUnit, and Sauce Labs

David Ross Drake
4/12/2013                                            2




Dynacron Group
• Surprisingly, not the evil corporation from that
  80’s dystopian sci-fi movie
• Actually a Seattle consultancy that helps
  companies implement continuous delivery…
   • Integrated Testing
   • Custom Development
   • Big Data Strategies
   • Deployment Automation
4/12/2013                                   3




A Common Selenium Problem
• Tests are slow
• Lots of combinations need to be tested
   • Browsers
   • Versions
   • Operating Systems
   • Languages
   • Skins
• Combination interfaces are very similar
4/12/2013                                       4




Parameter Description
                  Browser

            -   Application
            -   Type
            -   Version
            -   OS
                                   Brand

                              - Code
                              - URL Component
                   Locale

            - Language
            - Country
4/12/2013                                   5




Extant Solution: CSV



• Simple for Manual    • Incapable of
  Testers to Use         containing
• Allows some nested     complicated data
  structures (PSV in   • Hard to Read
  CSV…)                • Ugly
4/12/2013            6




   TYPESAFE CONFIG
   Demo
But the Problem is Actually Worse…
             IC   CP       IN       HI       EX       SB   CW   6C       PCR
US En                  X        X        X        X    X    X        X     X
UK En         X        X                 X        X    X             X
French                 X        X        X        X    X    X        X     X
German                 X        X        X        X                  X     X
Japanese      X                                                      X     X
Chinese       X        X        X        X        X                  X     X
Korean        X                                                      X     X
Italian                                  X        X                  X     X
Arabic                                                               X
Hebrew                                                               X
Portuguese                                                           X     X
Spanish       X        X        X        X        X    X             X     X
Russian                                                              X
Turkish                                                              X
4/12/2013                                            8




How Many Combinations?
• Browsers: A, B, C, D, E
• Locales: 1, 2, 3, 4
• Brands: X, Y, Z


Let S1 be the size of the largest parameter array,
S2 be the next largest, etc…
4/12/2013                                  9




Each Once?
• Browsers: A, B, C, D, E   1. (A, 1, X)
• Locales: 1, 2, 3, 4       2. (B, 2, Y)
• Brands: X, Y, Z           3. (C, 3, Z)
                            4. (D, 4, X)
Number of                   5. (E, 1, Y)
combinations: S1
4/12/2013                                               10




All Pairs?
• Browsers: A, B, C, D, E   1.  (A, 1, X)   11. (C, 3, Y)
                            2. (A, 2, Y)    12. (C, 4, Z)
• Locales: 1, 2, 3, 4
                            3. (A, 3, Z)    13. (D, 1, X)
• Brands: X, Y, Z           4. (A, 4, X)    14. (D, 2, Y)
                            5. (B, 1, Y)    15. (D, 3, Z)
                            6. (B, 2, Z)    16. (D, 4, X)
Number of                   7. (B, 3, X)    17. (E, 1, Y)
combinations: (S1S2)        8. (B, 4, Y)    18. (E, 2, Z)
                            9. (C, 1, Z)    19. (E, 3, X)
                            10. (C, 2, X)   20. (E, 4, Y)
4/12/2013                                               11




All?
• Browsers: A, B, C, D, E   1.  (A, 1, X)   11. (A, 4, Y)
                            2. (A, 1, Y)    12. (A, 4, Z)
• Locales: 1, 2, 3, 4
                            3. (A, 1, Z)    13. (B, 1, X)
• Brands: X, Y, Z           4. (A, 2, X)    14. (B, 1, Y)
                            5. (A, 2, Y)    15. (B, 1, Z)
                            6. (A, 2, Z)    16. (B, 2, X)
Number of                   7. (A, 3, X)    17. (B, 2, Y)
combinations: (S1S2S3)      8. (A, 3, Y)    18. (B, 2, Z)
                            9. (A, 3, Z)    19. (B, 3, X)
                            10. (A, 4, X)   20. …
4/12/2013                                                12




Risk vs Rewards
Risk                           Reward
x = probability a given pair   y = average time it takes to
has a failure only found       test a combination
when together                  P = Fraction of testing time
R = probability that “each-    taken testing “each-once”
once” fails to reveal a        as compared to “all-pairs”
defect that could be seen
in “all-pairs”                 M = S1 / S1S2

R = (1 - x) ^ (S1S2 – S1)
4/12/2013                                                                       13




Converting Combinations into Tests
    Read Parameters
    • Add overrides for class, profiles, and system properties
    • Read as TypeSafe Config objects



            Form list of config combinations
            • Apply combination strategy from config



                  Convert configurations back into json
                  • Simple in TypeSafe Config – prevents writing custom
                    object mapping



                        Deserialize json combination in
                        ParameterCombination object
                        • Uses Jackson and @FromJson annotations as necessary
4/12/2013                    14




Parallelization
• Easy to Implement
   • See Sauce Labs blogs!
• Very hard to do right
   • See demo
4/12/2013                                       15




Class Browser Reuse
b = time to start and close browser
t = average time to run a test method
m = average number of methods in a class
F = fraction of time spent testing when using
one browser per class instead of per method

F = (b/m + t) / (b + t)
4/12/2013                                       16




Class Browser Reuse (small tests)
15 = time to start and close browser
6 = average time to run a test method
5 = average number of methods in a class
F = fraction of time spent testing when using
one browser per class instead of per method

F = (15/5 + 6) / (15 + 6) = 3/7 = 42.9%
4/12/2013                                       17




Class Browser Reuse (long tests)
15 = time to start and close browser
60 = average time to run a test method
5 = average number of methods in a class
F = fraction of time spent testing when using
one browser per class instead of per method

F = (15/5 + 60) / (15 + 60) = 21/25 = 84%
4/12/2013                     18




Tracking Parameterized and
Parallelized Tests
• Descriptive method naming
• Descriptive logging
• Demo!
4/12/2013                                      19




Future Work
• Remembering Tested Combinations in
  Coverage Reports
• Effectively displaying tested combinations
• Converting to using Junit 4.11 style
  parameterized runner.
4/12/2013                                      20




Questions?
• Parallel Webtest: https://github.com/dynacron-
  group/parallel-webtest
• TypeSafe Config:
  https://github.com/typesafehub/config
• Sauce post that provided the seed:
  http://sauceio.com/index.php/2010/10/paralle
  l-junit-4-and-selenium-part-three-parallelism-
  and-ondemand/

More Related Content

More from Sauce Labs

Just Enough (Automated) Testing
Just Enough (Automated) TestingJust Enough (Automated) Testing
Just Enough (Automated) TestingSauce Labs
 
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium TestsUsing Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium TestsSauce Labs
 
How Open Source Helps to Bring Back Product Obsession
How Open Source Helps to Bring Back Product ObsessionHow Open Source Helps to Bring Back Product Obsession
How Open Source Helps to Bring Back Product ObsessionSauce Labs
 
Webinar: A Sneak Peek at Selenium 4 with Simon Stewart
Webinar: A Sneak Peek at Selenium 4 with Simon StewartWebinar: A Sneak Peek at Selenium 4 with Simon Stewart
Webinar: A Sneak Peek at Selenium 4 with Simon StewartSauce Labs
 
[Deu] Test Automatisierung Mit Web Driver.io
[Deu] Test Automatisierung Mit Web Driver.io[Deu] Test Automatisierung Mit Web Driver.io
[Deu] Test Automatisierung Mit Web Driver.ioSauce Labs
 
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...Sauce Labs
 
Accelerating Your Digital Agenda with Continuous Testing ft. Forrester
Accelerating Your Digital Agenda with Continuous Testing ft. ForresterAccelerating Your Digital Agenda with Continuous Testing ft. Forrester
Accelerating Your Digital Agenda with Continuous Testing ft. ForresterSauce Labs
 
How to Measure Success in Continuous Testing
How to Measure Success in Continuous TestingHow to Measure Success in Continuous Testing
How to Measure Success in Continuous TestingSauce Labs
 
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...Sauce Labs
 
5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test Automation5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test AutomationSauce Labs
 
Sauce Labs Webinar: Rising Importance of Software Testing
Sauce Labs Webinar: Rising Importance of Software TestingSauce Labs Webinar: Rising Importance of Software Testing
Sauce Labs Webinar: Rising Importance of Software TestingSauce Labs
 
BDD With Selenide by Hima Bindu Peteti
BDD With Selenide by Hima Bindu PetetiBDD With Selenide by Hima Bindu Peteti
BDD With Selenide by Hima Bindu PetetiSauce Labs
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Sauce Labs
 
Continuous Delivery for "Mature" Codebases by Melisa Benua
Continuous Delivery for "Mature" Codebases by Melisa BenuaContinuous Delivery for "Mature" Codebases by Melisa Benua
Continuous Delivery for "Mature" Codebases by Melisa BenuaSauce Labs
 
Building Automation Engineers From Scratch by Jenny Bramble
Building Automation Engineers From Scratch by Jenny BrambleBuilding Automation Engineers From Scratch by Jenny Bramble
Building Automation Engineers From Scratch by Jenny BrambleSauce Labs
 
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha Coffman
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha CoffmanAutomated Testing at The Speed of Headless by Alissa Lydon and Samantha Coffman
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha CoffmanSauce Labs
 
Building The Blocks of Trust in Automation by Sneha Viswalingam
Building The Blocks of Trust in Automation by Sneha ViswalingamBuilding The Blocks of Trust in Automation by Sneha Viswalingam
Building The Blocks of Trust in Automation by Sneha ViswalingamSauce Labs
 
What's that smell? Tidying Up our Test Code by Angie Jones
What's that smell? Tidying Up our Test Code by Angie JonesWhat's that smell? Tidying Up our Test Code by Angie Jones
What's that smell? Tidying Up our Test Code by Angie JonesSauce Labs
 
Wait, That's Not Right by Troy Walsh
Wait, That's Not Right by Troy WalshWait, That's Not Right by Troy Walsh
Wait, That's Not Right by Troy WalshSauce Labs
 
Using Kubernetes to Host Sauce Connect Tunnels by Morgan Vergara
Using Kubernetes to Host Sauce Connect Tunnels by Morgan VergaraUsing Kubernetes to Host Sauce Connect Tunnels by Morgan Vergara
Using Kubernetes to Host Sauce Connect Tunnels by Morgan VergaraSauce Labs
 

More from Sauce Labs (20)

Just Enough (Automated) Testing
Just Enough (Automated) TestingJust Enough (Automated) Testing
Just Enough (Automated) Testing
 
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium TestsUsing Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
 
How Open Source Helps to Bring Back Product Obsession
How Open Source Helps to Bring Back Product ObsessionHow Open Source Helps to Bring Back Product Obsession
How Open Source Helps to Bring Back Product Obsession
 
Webinar: A Sneak Peek at Selenium 4 with Simon Stewart
Webinar: A Sneak Peek at Selenium 4 with Simon StewartWebinar: A Sneak Peek at Selenium 4 with Simon Stewart
Webinar: A Sneak Peek at Selenium 4 with Simon Stewart
 
[Deu] Test Automatisierung Mit Web Driver.io
[Deu] Test Automatisierung Mit Web Driver.io[Deu] Test Automatisierung Mit Web Driver.io
[Deu] Test Automatisierung Mit Web Driver.io
 
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
Accelerating Innovation: Leveraging Open Source to Optimize Your Shift-Left I...
 
Accelerating Your Digital Agenda with Continuous Testing ft. Forrester
Accelerating Your Digital Agenda with Continuous Testing ft. ForresterAccelerating Your Digital Agenda with Continuous Testing ft. Forrester
Accelerating Your Digital Agenda with Continuous Testing ft. Forrester
 
How to Measure Success in Continuous Testing
How to Measure Success in Continuous TestingHow to Measure Success in Continuous Testing
How to Measure Success in Continuous Testing
 
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
From Zero to 2.7 Million - How Verizon Media Embraced Open Source to Accelera...
 
5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test Automation5 Steps to Jump Start Your Test Automation
5 Steps to Jump Start Your Test Automation
 
Sauce Labs Webinar: Rising Importance of Software Testing
Sauce Labs Webinar: Rising Importance of Software TestingSauce Labs Webinar: Rising Importance of Software Testing
Sauce Labs Webinar: Rising Importance of Software Testing
 
BDD With Selenide by Hima Bindu Peteti
BDD With Selenide by Hima Bindu PetetiBDD With Selenide by Hima Bindu Peteti
BDD With Selenide by Hima Bindu Peteti
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
 
Continuous Delivery for "Mature" Codebases by Melisa Benua
Continuous Delivery for "Mature" Codebases by Melisa BenuaContinuous Delivery for "Mature" Codebases by Melisa Benua
Continuous Delivery for "Mature" Codebases by Melisa Benua
 
Building Automation Engineers From Scratch by Jenny Bramble
Building Automation Engineers From Scratch by Jenny BrambleBuilding Automation Engineers From Scratch by Jenny Bramble
Building Automation Engineers From Scratch by Jenny Bramble
 
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha Coffman
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha CoffmanAutomated Testing at The Speed of Headless by Alissa Lydon and Samantha Coffman
Automated Testing at The Speed of Headless by Alissa Lydon and Samantha Coffman
 
Building The Blocks of Trust in Automation by Sneha Viswalingam
Building The Blocks of Trust in Automation by Sneha ViswalingamBuilding The Blocks of Trust in Automation by Sneha Viswalingam
Building The Blocks of Trust in Automation by Sneha Viswalingam
 
What's that smell? Tidying Up our Test Code by Angie Jones
What's that smell? Tidying Up our Test Code by Angie JonesWhat's that smell? Tidying Up our Test Code by Angie Jones
What's that smell? Tidying Up our Test Code by Angie Jones
 
Wait, That's Not Right by Troy Walsh
Wait, That's Not Right by Troy WalshWait, That's Not Right by Troy Walsh
Wait, That's Not Right by Troy Walsh
 
Using Kubernetes to Host Sauce Connect Tunnels by Morgan Vergara
Using Kubernetes to Host Sauce Connect Tunnels by Morgan VergaraUsing Kubernetes to Host Sauce Connect Tunnels by Morgan Vergara
Using Kubernetes to Host Sauce Connect Tunnels by Morgan Vergara
 

Works in (X, Y, Z): Parallel Combination Testing With Selenium, JUnit, and Sauce

  • 1. WORKS IN (X, Y, Z) Parallel Combination Testing With Selenium, JUnit, and Sauce Labs David Ross Drake
  • 2. 4/12/2013 2 Dynacron Group • Surprisingly, not the evil corporation from that 80’s dystopian sci-fi movie • Actually a Seattle consultancy that helps companies implement continuous delivery… • Integrated Testing • Custom Development • Big Data Strategies • Deployment Automation
  • 3. 4/12/2013 3 A Common Selenium Problem • Tests are slow • Lots of combinations need to be tested • Browsers • Versions • Operating Systems • Languages • Skins • Combination interfaces are very similar
  • 4. 4/12/2013 4 Parameter Description Browser - Application - Type - Version - OS Brand - Code - URL Component Locale - Language - Country
  • 5. 4/12/2013 5 Extant Solution: CSV • Simple for Manual • Incapable of Testers to Use containing • Allows some nested complicated data structures (PSV in • Hard to Read CSV…) • Ugly
  • 6. 4/12/2013 6 TYPESAFE CONFIG Demo
  • 7. But the Problem is Actually Worse… IC CP IN HI EX SB CW 6C PCR US En X X X X X X X X UK En X X X X X X French X X X X X X X X German X X X X X X Japanese X X X Chinese X X X X X X X Korean X X X Italian X X X X Arabic X Hebrew X Portuguese X X Spanish X X X X X X X X Russian X Turkish X
  • 8. 4/12/2013 8 How Many Combinations? • Browsers: A, B, C, D, E • Locales: 1, 2, 3, 4 • Brands: X, Y, Z Let S1 be the size of the largest parameter array, S2 be the next largest, etc…
  • 9. 4/12/2013 9 Each Once? • Browsers: A, B, C, D, E 1. (A, 1, X) • Locales: 1, 2, 3, 4 2. (B, 2, Y) • Brands: X, Y, Z 3. (C, 3, Z) 4. (D, 4, X) Number of 5. (E, 1, Y) combinations: S1
  • 10. 4/12/2013 10 All Pairs? • Browsers: A, B, C, D, E 1. (A, 1, X) 11. (C, 3, Y) 2. (A, 2, Y) 12. (C, 4, Z) • Locales: 1, 2, 3, 4 3. (A, 3, Z) 13. (D, 1, X) • Brands: X, Y, Z 4. (A, 4, X) 14. (D, 2, Y) 5. (B, 1, Y) 15. (D, 3, Z) 6. (B, 2, Z) 16. (D, 4, X) Number of 7. (B, 3, X) 17. (E, 1, Y) combinations: (S1S2) 8. (B, 4, Y) 18. (E, 2, Z) 9. (C, 1, Z) 19. (E, 3, X) 10. (C, 2, X) 20. (E, 4, Y)
  • 11. 4/12/2013 11 All? • Browsers: A, B, C, D, E 1. (A, 1, X) 11. (A, 4, Y) 2. (A, 1, Y) 12. (A, 4, Z) • Locales: 1, 2, 3, 4 3. (A, 1, Z) 13. (B, 1, X) • Brands: X, Y, Z 4. (A, 2, X) 14. (B, 1, Y) 5. (A, 2, Y) 15. (B, 1, Z) 6. (A, 2, Z) 16. (B, 2, X) Number of 7. (A, 3, X) 17. (B, 2, Y) combinations: (S1S2S3) 8. (A, 3, Y) 18. (B, 2, Z) 9. (A, 3, Z) 19. (B, 3, X) 10. (A, 4, X) 20. …
  • 12. 4/12/2013 12 Risk vs Rewards Risk Reward x = probability a given pair y = average time it takes to has a failure only found test a combination when together P = Fraction of testing time R = probability that “each- taken testing “each-once” once” fails to reveal a as compared to “all-pairs” defect that could be seen in “all-pairs” M = S1 / S1S2 R = (1 - x) ^ (S1S2 – S1)
  • 13. 4/12/2013 13 Converting Combinations into Tests Read Parameters • Add overrides for class, profiles, and system properties • Read as TypeSafe Config objects Form list of config combinations • Apply combination strategy from config Convert configurations back into json • Simple in TypeSafe Config – prevents writing custom object mapping Deserialize json combination in ParameterCombination object • Uses Jackson and @FromJson annotations as necessary
  • 14. 4/12/2013 14 Parallelization • Easy to Implement • See Sauce Labs blogs! • Very hard to do right • See demo
  • 15. 4/12/2013 15 Class Browser Reuse b = time to start and close browser t = average time to run a test method m = average number of methods in a class F = fraction of time spent testing when using one browser per class instead of per method F = (b/m + t) / (b + t)
  • 16. 4/12/2013 16 Class Browser Reuse (small tests) 15 = time to start and close browser 6 = average time to run a test method 5 = average number of methods in a class F = fraction of time spent testing when using one browser per class instead of per method F = (15/5 + 6) / (15 + 6) = 3/7 = 42.9%
  • 17. 4/12/2013 17 Class Browser Reuse (long tests) 15 = time to start and close browser 60 = average time to run a test method 5 = average number of methods in a class F = fraction of time spent testing when using one browser per class instead of per method F = (15/5 + 60) / (15 + 60) = 21/25 = 84%
  • 18. 4/12/2013 18 Tracking Parameterized and Parallelized Tests • Descriptive method naming • Descriptive logging • Demo!
  • 19. 4/12/2013 19 Future Work • Remembering Tested Combinations in Coverage Reports • Effectively displaying tested combinations • Converting to using Junit 4.11 style parameterized runner.
  • 20. 4/12/2013 20 Questions? • Parallel Webtest: https://github.com/dynacron- group/parallel-webtest • TypeSafe Config: https://github.com/typesafehub/config • Sauce post that provided the seed: http://sauceio.com/index.php/2010/10/paralle l-junit-4-and-selenium-part-three-parallelism- and-ondemand/

Editor's Notes

  1. Also, a great place to work.
  2. Jump from here to demonstration of IHG’s site.
  3. Limitations
  4. Jump from here to demonstration of solution using typesafeconfig
  5. Jump from here to demonstration of IHG’s site.
  6. Jump from here to demonstration of IHG’s site.
  7. Jump from here to demonstration of IHG’s site.
  8. Jump from here to demonstration of IHG’s site.
  9. Biggest problem: what the hell is x?
  10. Hey: it takes forever to run all these combinations
  11. Hey: it takes forever to run all these combinations
  12. Hey: it takes forever to run all these combinations
  13. Hey: it takes forever to run all these combinations
  14. Hey: it takes forever to run all these combinations
  15. Also, a great place to work.