Automated Acceptance Testing Example HANI MASSOUD 1
Objective  Get a first taste of automated acceptance tests  See some automated tests in action:  An online store with a product catalogue  An automated Specification (how we expect the online store to behave)  Run the Specification  Verify the results 2
Contents  What are we Testing?  How are we Testing?  Automated Testing Demo  Benefits / Investment 3
What are we testing?  System Under Test (SUT)  Web Application: Lift Web Server App, REST Web Services, AngularJS Web Pages  Features: Home Page, Catalogue, Shopping Cart Browser HTML5, CSS3, AngularJS App Server Database Server REST Web Services Relational Lift Web Application Database • Page structure • Look and feel • Presentation logic • User Experience • REST web services • Business logic • Persistence logic • Persistence • Data Model 4 A web application REST
What are we testing? 5 An online store Categories Products Menu
How are we testing? 6 Automated With a little help from Selenium and friends
How are we testing? 7 3 Steps 1. Specify Desired Behaviour 2. Execute Specification 3. Verify Results Online  Specs written in Jasmine from Pivotal Labs  Browser automation by Selenium WebDriver and Protractor from Google  Unit Test reports by Jasmine  Acceptance Test reports Protractor-html-screenshot-reporter from Jintoppy
Demo  Step 1: Specify Desired Behaviour  Step 2: Execute Specification  Step 3: Verify Results Online 8 Specifications are automated scripts that we can execute Specs are executed during development Test results are generated automatically Demo
Step 1: Specify Desired Behaviour 9 Desired behaviour is Specified in a Jasmine script developed in the WebStorm JavaScript IDE. Writing Jasmine Specifications is beyond the scope of this demo. Follow the Jasmine link to learn more.
Step 2: Execute Specification  2.1 Start the System Under Test (SUT)  2.2 Start Selenium WebDriver  2.3 Execute the Specifications 10
2.1 Start the System Under Test  Go to project directory  Run sbt-staging  Start up server: container:start 11 In this step I started the application in a staging environment for testing purposes. The application must be running so that Selenium WebDriver can perform the specified tests in the following steps.
2.2 Start Selenium WebDriver  Run webdriver-manager start 12 After this step, Selenium WebDriver is running and ready to execute tests that we will run in the next step.
2.3 Execute the Specifications  Go to project directory  Execute specifications  Run the command: protractor srcmainwebappspece2eConf.js  Protractor runs the Specified tests through Selenium WebDriver 13 See the video on the next page to see our automated tests in action.
2.3 Execute the Specifications  Go to project directory  Execute specifications  Run the command: protractor srcmainwebappspece2eConf.js  Protractor will open the browser and run the Specified tests 14
3. Verify the Results Online  Open report in browser 15 After the tests are completed, a report is automatically generated to show the results. The report is structured by Feature, Story and Scenario as per our Specification. The Specification is “living documentation” of our application.
Benefits / Investment  Specs are living documentation of the system  Specs are reusable for regression tests  Specs create their own test data  System Under Test should provide Web pages or Web services that Selenium WebDriver can drive  Automated Specs need maintenance like any other code base 16
Thank You  Hani Massoud  http://au.linkedin.com/in/hanimassoud/ 17

Automated Acceptance Testing Example

  • 1.
    Automated Acceptance TestingExample HANI MASSOUD 1
  • 2.
    Objective  Geta first taste of automated acceptance tests  See some automated tests in action:  An online store with a product catalogue  An automated Specification (how we expect the online store to behave)  Run the Specification  Verify the results 2
  • 3.
    Contents  Whatare we Testing?  How are we Testing?  Automated Testing Demo  Benefits / Investment 3
  • 4.
    What are wetesting?  System Under Test (SUT)  Web Application: Lift Web Server App, REST Web Services, AngularJS Web Pages  Features: Home Page, Catalogue, Shopping Cart Browser HTML5, CSS3, AngularJS App Server Database Server REST Web Services Relational Lift Web Application Database • Page structure • Look and feel • Presentation logic • User Experience • REST web services • Business logic • Persistence logic • Persistence • Data Model 4 A web application REST
  • 5.
    What are wetesting? 5 An online store Categories Products Menu
  • 6.
    How are wetesting? 6 Automated With a little help from Selenium and friends
  • 7.
    How are wetesting? 7 3 Steps 1. Specify Desired Behaviour 2. Execute Specification 3. Verify Results Online  Specs written in Jasmine from Pivotal Labs  Browser automation by Selenium WebDriver and Protractor from Google  Unit Test reports by Jasmine  Acceptance Test reports Protractor-html-screenshot-reporter from Jintoppy
  • 8.
    Demo  Step1: Specify Desired Behaviour  Step 2: Execute Specification  Step 3: Verify Results Online 8 Specifications are automated scripts that we can execute Specs are executed during development Test results are generated automatically Demo
  • 9.
    Step 1: SpecifyDesired Behaviour 9 Desired behaviour is Specified in a Jasmine script developed in the WebStorm JavaScript IDE. Writing Jasmine Specifications is beyond the scope of this demo. Follow the Jasmine link to learn more.
  • 10.
    Step 2: ExecuteSpecification  2.1 Start the System Under Test (SUT)  2.2 Start Selenium WebDriver  2.3 Execute the Specifications 10
  • 11.
    2.1 Start theSystem Under Test  Go to project directory  Run sbt-staging  Start up server: container:start 11 In this step I started the application in a staging environment for testing purposes. The application must be running so that Selenium WebDriver can perform the specified tests in the following steps.
  • 12.
    2.2 Start SeleniumWebDriver  Run webdriver-manager start 12 After this step, Selenium WebDriver is running and ready to execute tests that we will run in the next step.
  • 13.
    2.3 Execute theSpecifications  Go to project directory  Execute specifications  Run the command: protractor srcmainwebappspece2eConf.js  Protractor runs the Specified tests through Selenium WebDriver 13 See the video on the next page to see our automated tests in action.
  • 14.
    2.3 Execute theSpecifications  Go to project directory  Execute specifications  Run the command: protractor srcmainwebappspece2eConf.js  Protractor will open the browser and run the Specified tests 14
  • 15.
    3. Verify theResults Online  Open report in browser 15 After the tests are completed, a report is automatically generated to show the results. The report is structured by Feature, Story and Scenario as per our Specification. The Specification is “living documentation” of our application.
  • 16.
    Benefits / Investment  Specs are living documentation of the system  Specs are reusable for regression tests  Specs create their own test data  System Under Test should provide Web pages or Web services that Selenium WebDriver can drive  Automated Specs need maintenance like any other code base 16
  • 17.
    Thank You Hani Massoud  http://au.linkedin.com/in/hanimassoud/ 17