SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Using Selenium to Improve a Team's
        Development Cycle

                  Selenium Conference 2012
                  Mike Davis - Google
Background
Background


What is a Software Engineer in Test?



  "Engineer who does everything and anything to improve
  productivity and quality of Google products."
How Can Selenium Improve a Team's
Development Cycle?

The Objectives

 ●   Catch bugs before submission
 ●   Provide high confidence that system is working
 ●   Release faster & more often
 ●   Catch bugs not likely to be caught by manual QA
How Can Selenium Improve a Team's
Development Cycle?

The Strategy

 ●   Tests are written at the same time as features
 ●   Tests are run before every check-in
 ●   Code that breaks a test is not submitted
 ●   Tests run at all stages of the development process
How Can Selenium Improve a Team's
Development Cycle?

Some Corollaries

 ●   Tests must be run as much as possible
 ●   Developers must be involved in writing and maintaining tests
 ●   We need really good tests
What Makes Good Functional Tests?


        ● Fast & Stable
        ● Easy to run
        ● Easy to read
        ● Easy to debug
        ● Easy to write
What Makes Good Functional Tests?

Tests Must Run From a Single Command (Or IDE)

        ●   No "follow steps in this wiki"
        ●   No "first install this software"
        ●   No "Add yourself to this unix group"
        ●   No "First visit website and sign up a new user"
        ●   No command line flags




  Run this command & everything "just works"
What Makes Good Functional Tests?

Hermetic Tests

Hermetic:
 ● Self contained
 ● No external dependencies




Managing dependencies:
● Run them in-memory as well
● Look for in-memory implementations of data-stores
● Fake out dependencies that can't be brought up
What Makes Good Functional Tests?

Keep Tests Small / Limit Number of Tests

  Limit the number of tests:
   ● Do you really need this test?
   ● Is this already covered by unit tests?
   ● Can you write a unit test for this?




  Keep tests small:
   ● Can you make it 2 tests?
What Makes Good Functional Tests?

Tests Set Up All Data
 public void testUserHasOnePurchase() {
   AccountPage accountPage = loginPage.login("testUser1", "testPassword");
   assertEquals(1, accountPage.getPurchaseCount());
 }

  Example Failure 1:
               Exception: Expected <1> got <2>


  Example Failure 2:
               Exception: Login Failed
What Makes Good Functional Tests?

Errors Are Easy to Track Down
●   Assertions have useful error messages
              Exception : False line:225
         VS

              Exception : Expected User to Have Purchase

●   Supply Screenshots of Error States
                                                   Screenshot:


    Exception: Timed out locating element
    "By.id = SearchButton". A screenshot has
    been saved at http://screenshot/_Ghktyc
What Makes Good Functional Tests?
Errors Are Easy to Track Down
●     Misleading exceptions should be
      wrapped.

    Exception: Timed out locating element "By.id = BuyButton"


    Exception: Error page detected locating element "By.id = BuyButton"




●     Grab server side logs
    Exception: Error page detected locating element "By.id = BuyButton"
               ServerSide: NullPointerException @Purchase.java line 225
What Makes Good Functional Tests?

Example
 public class OrdersTest extends TestCase {
 ...
   public void setUp() {
     server = new LocalRunningServer();
     server.initialize();
     pathFinder = new PathFinder(server.getAddress());
  }

 public void testOrdersShowInAccount() {
   User user = userCreator.createNewUser();
   purchaser.makePurchaseForUser(user);

         HomePage homePage = pathFinder.getHomePage();
         LoginPage loginPage = homePage.navigateToLoginPage();
         UserDashboard userDashboard = loginPage.loginAs(user);
         OrdersPage ordersPage = userDashboard.navigateToMyOrders();

         assertEquals(1, ordersPage.getNumberOfOrders());
     }
 }
What Makes Good Functional Tests?

Counter Example
Bad                                                       Better
public class OrdersPage implements PageObject {       public class OrdersPage implements PageObject {
...                                                   ...
  public WebElement getOrder() {                        public String getOrderId() {
    if (!hasOrders()) {                                   assert(hasOrders(),
       createOrder();                                           "Expected orders but none found") ;
    }                                                     return driver.findElement("order").getText();
    return driver.findElement("order");                 }
  }
                                                          public List<String> getOrderIds() {
    public List<WebElement> getOrders() {                   ...
      return driver.findElements(By.name("order"));       }
    }                                                 }
}
Going Beyond
Going Beyond

Testing In-Memory Servers vs Deployed Servers
 Objective:
  ● Run tests at all stages of development cycle


 Problem:
  ● Priorities for Release Candidate are different
  ● Already have good suite of tests, don't want to
    write another
                                  Server




                         Local             Remote
                         Server            Server
Going Beyond

Profiling Tests
                                                                 Browser          Ajax        Server



             TestLoadHomePage() - Call Profile at Every Commit

                                                                           Key:
         3
No. of                                                                     GetHomePageData
Calls
                                                                           GetSpecialOffers
         2
                                                                           GetUserData

                                                                           AddToBasket
         1




                               History of Project
Summary

Using Selenium to Improve a Team's Development Cycle:

● Run tests as often as possible
● Get dev involved
● Good tests
  ○ Fast & Stable
  ○ Easy to run
  ○ Easy to read
  ○ Easy to debug
  ○ Easy to write

There are loads of ways to extend a good suite of tests.
Questions?

Contenu connexe

Tendances

Exactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in KostromaExactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in Kostroma
Iosif Itkin
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
Anton Arhipov
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 

Tendances (20)

The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React App
 
Learn SoapUI
Learn SoapUILearn SoapUI
Learn SoapUI
 
Exactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in KostromaExactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in Kostroma
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
 
How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?
 
Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Acceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmAcceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvm
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with selenium
 
Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018Jest: Frontend Testing leicht gemacht @EnterJS2018
Jest: Frontend Testing leicht gemacht @EnterJS2018
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 

En vedette

Introducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test DevelopmentIntroducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test Development
seleniumconf
 

En vedette (6)

Introducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test DevelopmentIntroducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test Development
 
Automatic Test Case Generation
Automatic Test Case GenerationAutomatic Test Case Generation
Automatic Test Case Generation
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
 
TMPA-2017: A Survey on Model-Based Testing Tools for Test Case Generation
TMPA-2017: A Survey on Model-Based Testing Tools for Test Case GenerationTMPA-2017: A Survey on Model-Based Testing Tools for Test Case Generation
TMPA-2017: A Survey on Model-Based Testing Tools for Test Case Generation
 
[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios
[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios
[HCMC STC Jan 2015] FATS: A Framework For Automated Testing Scenarios
 

Similaire à Using Selenium to Improve a Teams Development Cycle

Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
drewz lin
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
Vlad Maniak
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
Tobias Schneck
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
Tobias Schneck
 

Similaire à Using Selenium to Improve a Teams Development Cycle (20)

Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 
Selenium
SeleniumSelenium
Selenium
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Workshop quality assurance for php projects - phpdublin
Workshop quality assurance for php projects - phpdublinWorkshop quality assurance for php projects - phpdublin
Workshop quality assurance for php projects - phpdublin
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Writing better tests for your java script app
Writing better tests for your java script appWriting better tests for your java script app
Writing better tests for your java script app
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
 
Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
Михаил Боднарчук "Acceptance Testing in NodeJS: Tools & Approaches"
 
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan KuštInfinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
 

Plus de seleniumconf

More Than Automation - How Good Acceptance Tests Can Make Your Team Happier
More Than Automation - How Good Acceptance Tests Can Make Your Team HappierMore Than Automation - How Good Acceptance Tests Can Make Your Team Happier
More Than Automation - How Good Acceptance Tests Can Make Your Team Happier
seleniumconf
 
Building a Selenium Community One Meetup at a Time
Building a Selenium Community One Meetup at a TimeBuilding a Selenium Community One Meetup at a Time
Building a Selenium Community One Meetup at a Time
seleniumconf
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshop
seleniumconf
 
Automated Security Testing
Automated Security TestingAutomated Security Testing
Automated Security Testing
seleniumconf
 
Selenium: State of the Union
Selenium: State of the UnionSelenium: State of the Union
Selenium: State of the Union
seleniumconf
 
Automated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriverAutomated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriver
seleniumconf
 
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer DriverBuilding a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
seleniumconf
 
Massively Continuous Integration: From 3 days to 30 minutes
Massively Continuous Integration: From 3 days to 30 minutesMassively Continuous Integration: From 3 days to 30 minutes
Massively Continuous Integration: From 3 days to 30 minutes
seleniumconf
 

Plus de seleniumconf (8)

More Than Automation - How Good Acceptance Tests Can Make Your Team Happier
More Than Automation - How Good Acceptance Tests Can Make Your Team HappierMore Than Automation - How Good Acceptance Tests Can Make Your Team Happier
More Than Automation - How Good Acceptance Tests Can Make Your Team Happier
 
Building a Selenium Community One Meetup at a Time
Building a Selenium Community One Meetup at a TimeBuilding a Selenium Community One Meetup at a Time
Building a Selenium Community One Meetup at a Time
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshop
 
Automated Security Testing
Automated Security TestingAutomated Security Testing
Automated Security Testing
 
Selenium: State of the Union
Selenium: State of the UnionSelenium: State of the Union
Selenium: State of the Union
 
Automated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriverAutomated Web App Performance Testing Using WebDriver
Automated Web App Performance Testing Using WebDriver
 
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer DriverBuilding a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
 
Massively Continuous Integration: From 3 days to 30 minutes
Massively Continuous Integration: From 3 days to 30 minutesMassively Continuous Integration: From 3 days to 30 minutes
Massively Continuous Integration: From 3 days to 30 minutes
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Using Selenium to Improve a Teams Development Cycle

  • 1. Using Selenium to Improve a Team's Development Cycle Selenium Conference 2012 Mike Davis - Google
  • 3. Background What is a Software Engineer in Test? "Engineer who does everything and anything to improve productivity and quality of Google products."
  • 4. How Can Selenium Improve a Team's Development Cycle? The Objectives ● Catch bugs before submission ● Provide high confidence that system is working ● Release faster & more often ● Catch bugs not likely to be caught by manual QA
  • 5. How Can Selenium Improve a Team's Development Cycle? The Strategy ● Tests are written at the same time as features ● Tests are run before every check-in ● Code that breaks a test is not submitted ● Tests run at all stages of the development process
  • 6. How Can Selenium Improve a Team's Development Cycle? Some Corollaries ● Tests must be run as much as possible ● Developers must be involved in writing and maintaining tests ● We need really good tests
  • 7. What Makes Good Functional Tests? ● Fast & Stable ● Easy to run ● Easy to read ● Easy to debug ● Easy to write
  • 8. What Makes Good Functional Tests? Tests Must Run From a Single Command (Or IDE) ● No "follow steps in this wiki" ● No "first install this software" ● No "Add yourself to this unix group" ● No "First visit website and sign up a new user" ● No command line flags Run this command & everything "just works"
  • 9. What Makes Good Functional Tests? Hermetic Tests Hermetic: ● Self contained ● No external dependencies Managing dependencies: ● Run them in-memory as well ● Look for in-memory implementations of data-stores ● Fake out dependencies that can't be brought up
  • 10. What Makes Good Functional Tests? Keep Tests Small / Limit Number of Tests Limit the number of tests: ● Do you really need this test? ● Is this already covered by unit tests? ● Can you write a unit test for this? Keep tests small: ● Can you make it 2 tests?
  • 11. What Makes Good Functional Tests? Tests Set Up All Data public void testUserHasOnePurchase() { AccountPage accountPage = loginPage.login("testUser1", "testPassword"); assertEquals(1, accountPage.getPurchaseCount()); } Example Failure 1: Exception: Expected <1> got <2> Example Failure 2: Exception: Login Failed
  • 12. What Makes Good Functional Tests? Errors Are Easy to Track Down ● Assertions have useful error messages Exception : False line:225 VS Exception : Expected User to Have Purchase ● Supply Screenshots of Error States Screenshot: Exception: Timed out locating element "By.id = SearchButton". A screenshot has been saved at http://screenshot/_Ghktyc
  • 13. What Makes Good Functional Tests? Errors Are Easy to Track Down ● Misleading exceptions should be wrapped. Exception: Timed out locating element "By.id = BuyButton" Exception: Error page detected locating element "By.id = BuyButton" ● Grab server side logs Exception: Error page detected locating element "By.id = BuyButton" ServerSide: NullPointerException @Purchase.java line 225
  • 14. What Makes Good Functional Tests? Example public class OrdersTest extends TestCase { ... public void setUp() { server = new LocalRunningServer(); server.initialize(); pathFinder = new PathFinder(server.getAddress()); } public void testOrdersShowInAccount() { User user = userCreator.createNewUser(); purchaser.makePurchaseForUser(user); HomePage homePage = pathFinder.getHomePage(); LoginPage loginPage = homePage.navigateToLoginPage(); UserDashboard userDashboard = loginPage.loginAs(user); OrdersPage ordersPage = userDashboard.navigateToMyOrders(); assertEquals(1, ordersPage.getNumberOfOrders()); } }
  • 15. What Makes Good Functional Tests? Counter Example Bad Better public class OrdersPage implements PageObject { public class OrdersPage implements PageObject { ... ... public WebElement getOrder() { public String getOrderId() { if (!hasOrders()) { assert(hasOrders(), createOrder(); "Expected orders but none found") ; } return driver.findElement("order").getText(); return driver.findElement("order"); } } public List<String> getOrderIds() { public List<WebElement> getOrders() { ... return driver.findElements(By.name("order")); } } } }
  • 17. Going Beyond Testing In-Memory Servers vs Deployed Servers Objective: ● Run tests at all stages of development cycle Problem: ● Priorities for Release Candidate are different ● Already have good suite of tests, don't want to write another Server Local Remote Server Server
  • 18. Going Beyond Profiling Tests Browser Ajax Server TestLoadHomePage() - Call Profile at Every Commit Key: 3 No. of GetHomePageData Calls GetSpecialOffers 2 GetUserData AddToBasket 1 History of Project
  • 19. Summary Using Selenium to Improve a Team's Development Cycle: ● Run tests as often as possible ● Get dev involved ● Good tests ○ Fast & Stable ○ Easy to run ○ Easy to read ○ Easy to debug ○ Easy to write There are loads of ways to extend a good suite of tests.