SlideShare a Scribd company logo
Smart acceptance GUI
tests with Selenium
>Denys~Zaiats
Agenda
1. Introduction into ATDD (BDD + Specification by example) and Cucumber.
2. Simple usage of Cucumber with Selenium.
3. Reporting as an important part of acceptance tests.
4. Smart UI testing.
What the software testing is?
Testing is the process of
evaluating a system or its
component(s) with the intent to
find whether it satisfies the
specified requirements or not.
Criterias of good tests:
● Highly accurate
● Easy maintainable and readable
● Good results
Highly accurate tests
1. Using auto-generate strings with special
symbols
2. Always to have different values for
usernames and passwords
3. Test boundary and middle values. (e.g:
0..100: -1, 0, 1, 25, 63, 99, 100, 101 )
4. Represent real business / user flow in the
tests
1. Using simple hardcoded strings for
verification like “abcd” or “1234”
2. Using username: test123 and password:
test123
3. Skipping the testing of boundary values
4. Jumping between the steps using tricky
navigation
Easy maintainable and readable tests
Scenario: Verify that main logo is displayed
When user navigates to 'https://www.facey.top'
Then page is displayed correctly
And language of the page is 'en'
driver.get(“https://www.facey.top”);
driver.findElement(By.id(“someId”)).isDisplayed()
;
…
function test(){
...
some function for verification of the language on
the page
...
}
Good results
Loading...
Test set: runner.RunnerMathTest
-------------------------------------------------------------------------------
Tests run: 8, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 19.809 sec
<<< FAILURE!
And language of the page is 'fr'(Scenario: Verify that main logo is
displayed) Time elapsed: 0.002 sec <<< FAILURE!
java.lang.AssertionError:
Recognised language on the page is: en
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at
steps.StepsImplementation.languageOfThePageIsEn(StepsImplementatio
n.java:55)
at ✽.And language of the page is 'fr'(smoke_scenario.feature:10)
Scenario: Verify that main logo is displayed Time elapsed: 0.003 sec
<<< FAILURE!
java.lang.AssertionError:
Recognised language on the page is: en
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at
steps.StepsImplementation.languageOfThePageIsEn(StepsImplementatio
n.java:55)
at ✽.And language of the page is 'fr'(smoke_scenario.feature:10)
Definition
“ATDD (Acceptance test-driven development) is a development methodology based on
communication between the business customers, the developers, and the testers. ATDD
encompasses many of the same practices as Specification by Example, Behaviour Driven
Development (BDD), Example-Driven Development (EDD), and Story Test-Driven Development
(SDD). All these processes aid developers and testers in understanding the customer’s needs
prior to implementation and allow customers to be able to converse in their own domain
language. ATDD is closely related to Test-Driven Development (TDD). It differs by the emphasis
on developer-tester-business customer collaboration. ATDD encompasses acceptance testing,
but highlights writing acceptance tests before developers begin coding.”
(from Wikipedia)
Smart acceptance GUI tests with Selenium
Specification by example
Author: Gojko Adzic
BDD frameworks for Java
Cucumber
Concordion
JBehave
Spock (groovy)
Easyb (groovy)
Example of Feature file
Not very clear scenario:
When user click on button
Then everything works
Selenium + Cucumber: how to start?
What You need to know about Cucumber
1. Maven dependencies to Cucumber
2. Feature file under “src/test/resources/../features/../”
3. Cucumber test runner
4. Implemented steps
Step 1. Prepare Yourself. Tools
1. IntelliJ IDEA
2. JDK 1.8
3. Maven
4. Set environment variables for JAVA and Maven (for Windows)
5. Install plugins for IntelliJ “Cucumber for Java” if not installed
6. Ready to go!
www.itarray.net - Lesson 1
Step 2. Maven dependencies
1. What is pom.xml?
2. Required dependencies for Cucumber and Selenium
Smart acceptance GUI tests with Selenium
Cucumbers features
1. Tags (@Smoke)
2. Scenario outlines (Tables)
Smart acceptance GUI tests with Selenium
First Selenium scenario
...So, what is Automotion?
Possibility to run any of existing web / mobile drivers from one place
Useful utils for web and mobile automation:
Scrolling, swiping, tapping, waiting, end so on
Manipulating by Android settings during test run
Validation of the language on web / mobile page
Tools for performing REST API testing
Testing of responsive design
Smart acceptance GUI tests with Selenium
Responsive design
How to test next things like:
Existing services
- Image recognition (not very effective)
- High costs
- Not easy integration with existing test framework
- Dependendencies to other services
- Specific syntax
What we need?
- Easy integration into existing framework
- Working with Selenium tests
- Readable syntax
- Fast and accurate results
Automotion Responsive UI Validator
We can do:
- Define approximate or precise values for measuring of the sizes
- Offsets and margins
- Comparison with offsets of other elements
- Overlapping (if inside or outside of specific elements)
- Correct alignment
- Different units for measuring
ResponsiveUIValidator uiValidator = new ResponsiveUIValidator(driver);
boolean result = uiValidator.init()
.findElement({rootEelement}, "Name of element")
.sameOffsetLeftAs({element} "Panel 1")
.sameOffsetLeftAs({element} "Button 1")
.sameOffsetRightAs({element} "Button 2")
.sameOffsetRightAs({element}, "Button 3)
.withCssValue("border", "2px", "solid", "#FBDCDC")
.withCssValue("border-radius", "4px")
.withoutCssValue("color", "#FFFFFF")
.sameSizeAs({list_elements},)
.insideOf({element}, "Container")
.notOverlapWith({element}, "Other element")
.withTopElement({element}, 10, 15)
.changeMetricsUnitsTo(ResponsiveUIValidator.Units.PERCENT)
.widthBetween(50, 55)
.heightBetween(90, 95)
.drawMap()
.validate();
uiValidator.generateReport();
Smart acceptance GUI tests with Selenium
Which platforms are supported
Summarise
BDD
Specification by example
Cucumber + Selenium
Visual UI testing
Questions?
Please, ask me what is unclear for You
Slide #30
Slide #30

More Related Content

What's hot (20)

PPT
Test Automation Framework Designs
Sauce Labs
 
PPTX
A Test Automation Framework
Gregory Solovey
 
PPTX
Software Automation Testing Introduction
Narayanan Palani
 
PPTX
Keyword-driven Test Automation Framework
Mikhail Subach
 
PPTX
Test Automation
Unmesh Ballal
 
PPTX
Automation Testing with Test Complete
Vartika Saxena
 
PDF
Automated Testing
John Paulett
 
PDF
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
PPTX
Test complete, work done so far
Leonel More, CSM, PMP, ITIL
 
PPTX
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
VibrantGroup
 
DOCX
Realtime selenium interview questions
Kuldeep Pawar
 
DOCX
Ajit jadhav automation_qa_4_ yrs
Ajit Jadhav
 
ODP
Jbossworld Presentation
Dan Hinojosa
 
PPT
Introduction of exception in vb.net
suraj pandey
 
PPT
Automation framework
ITeLearn
 
PDF
Shashank_Venkataramanacharya
Shashank Venkataramanacharya
 
DOC
Automation using ibm rft
Prashant Chaudhary
 
PDF
Open Source Software Testing Tools
Varuna Harshana
 
PPT
Test Automation Framework Development Introduction
Ganuka Yashantha
 
PPT
Hybrid Automation Framework Development introduction
Ganuka Yashantha
 
Test Automation Framework Designs
Sauce Labs
 
A Test Automation Framework
Gregory Solovey
 
Software Automation Testing Introduction
Narayanan Palani
 
Keyword-driven Test Automation Framework
Mikhail Subach
 
Test Automation
Unmesh Ballal
 
Automation Testing with Test Complete
Vartika Saxena
 
Automated Testing
John Paulett
 
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Test complete, work done so far
Leonel More, CSM, PMP, ITIL
 
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
VibrantGroup
 
Realtime selenium interview questions
Kuldeep Pawar
 
Ajit jadhav automation_qa_4_ yrs
Ajit Jadhav
 
Jbossworld Presentation
Dan Hinojosa
 
Introduction of exception in vb.net
suraj pandey
 
Automation framework
ITeLearn
 
Shashank_Venkataramanacharya
Shashank Venkataramanacharya
 
Automation using ibm rft
Prashant Chaudhary
 
Open Source Software Testing Tools
Varuna Harshana
 
Test Automation Framework Development Introduction
Ganuka Yashantha
 
Hybrid Automation Framework Development introduction
Ganuka Yashantha
 

Similar to Smart acceptance GUI tests with Selenium (20)

PDF
Acceptance Test-driven Development with Cucumber-jvm
Christopher Bartling
 
PDF
cucumber harpal.pdf
VennelaVasupilli
 
PPTX
Bdd with Cucumber and Mocha
Atish Narlawar
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PDF
Selenium with Cucumber
Knoldus Inc.
 
PPTX
BDD using Cucumber JVM
Vijay Krishnan Ramaswamy
 
PDF
Mastering BDD with Cucumber & Java for Test Automation
digitaljignect
 
PPT
Behavior Driven Development by Example
Nalin Goonawardana
 
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
Dev9Com
 
PPTX
BDD from QA side
Anton Shapin
 
PDF
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
KMS Technology
 
PPTX
Cucumber_Training_ForQA
Meenakshi Singhal
 
PPTX
Automation test framework with cucumber – BDD
123abcda
 
PPTX
Sexy Using Cucumber - BDD in your project
b4usolution .
 
PDF
Cucumber Basics.pdf
Mithilesh Singh
 
PPTX
Tutorial on the integration of Selenium with cucumber for experts and fresher’s
Chirag Thumar
 
PDF
BDD in Java using Cucumber
slavkurochkin
 
PDF
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
PPTX
Introduction to the functional test automation with cucumber and selenium
Isaias Silva
 
Acceptance Test-driven Development with Cucumber-jvm
Christopher Bartling
 
cucumber harpal.pdf
VennelaVasupilli
 
Bdd with Cucumber and Mocha
Atish Narlawar
 
Selenium with Cucumber
Knoldus Inc.
 
Selenium with Cucumber
Knoldus Inc.
 
Selenium with Cucumber
Knoldus Inc.
 
BDD using Cucumber JVM
Vijay Krishnan Ramaswamy
 
Mastering BDD with Cucumber & Java for Test Automation
digitaljignect
 
Behavior Driven Development by Example
Nalin Goonawardana
 
Automated Testing with Cucumber, PhantomJS and Selenium
Dev9Com
 
BDD from QA side
Anton Shapin
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
KMS Technology
 
Cucumber_Training_ForQA
Meenakshi Singhal
 
Automation test framework with cucumber – BDD
123abcda
 
Sexy Using Cucumber - BDD in your project
b4usolution .
 
Cucumber Basics.pdf
Mithilesh Singh
 
Tutorial on the integration of Selenium with cucumber for experts and fresher’s
Chirag Thumar
 
BDD in Java using Cucumber
slavkurochkin
 
Master Cucumber cheat sheet for testing .pdf
ArunVastrad4
 
Introduction to the functional test automation with cucumber and selenium
Isaias Silva
 
Ad

Smart acceptance GUI tests with Selenium

  • 1. Smart acceptance GUI tests with Selenium >Denys~Zaiats
  • 2. Agenda 1. Introduction into ATDD (BDD + Specification by example) and Cucumber. 2. Simple usage of Cucumber with Selenium. 3. Reporting as an important part of acceptance tests. 4. Smart UI testing.
  • 3. What the software testing is? Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the specified requirements or not. Criterias of good tests: ● Highly accurate ● Easy maintainable and readable ● Good results
  • 4. Highly accurate tests 1. Using auto-generate strings with special symbols 2. Always to have different values for usernames and passwords 3. Test boundary and middle values. (e.g: 0..100: -1, 0, 1, 25, 63, 99, 100, 101 ) 4. Represent real business / user flow in the tests 1. Using simple hardcoded strings for verification like “abcd” or “1234” 2. Using username: test123 and password: test123 3. Skipping the testing of boundary values 4. Jumping between the steps using tricky navigation
  • 5. Easy maintainable and readable tests Scenario: Verify that main logo is displayed When user navigates to 'https://www.facey.top' Then page is displayed correctly And language of the page is 'en' driver.get(“https://www.facey.top”); driver.findElement(By.id(“someId”)).isDisplayed() ; … function test(){ ... some function for verification of the language on the page ... }
  • 6. Good results Loading... Test set: runner.RunnerMathTest ------------------------------------------------------------------------------- Tests run: 8, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 19.809 sec <<< FAILURE! And language of the page is 'fr'(Scenario: Verify that main logo is displayed) Time elapsed: 0.002 sec <<< FAILURE! java.lang.AssertionError: Recognised language on the page is: en at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at steps.StepsImplementation.languageOfThePageIsEn(StepsImplementatio n.java:55) at ✽.And language of the page is 'fr'(smoke_scenario.feature:10) Scenario: Verify that main logo is displayed Time elapsed: 0.003 sec <<< FAILURE! java.lang.AssertionError: Recognised language on the page is: en at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at steps.StepsImplementation.languageOfThePageIsEn(StepsImplementatio n.java:55) at ✽.And language of the page is 'fr'(smoke_scenario.feature:10)
  • 7. Definition “ATDD (Acceptance test-driven development) is a development methodology based on communication between the business customers, the developers, and the testers. ATDD encompasses many of the same practices as Specification by Example, Behaviour Driven Development (BDD), Example-Driven Development (EDD), and Story Test-Driven Development (SDD). All these processes aid developers and testers in understanding the customer’s needs prior to implementation and allow customers to be able to converse in their own domain language. ATDD is closely related to Test-Driven Development (TDD). It differs by the emphasis on developer-tester-business customer collaboration. ATDD encompasses acceptance testing, but highlights writing acceptance tests before developers begin coding.” (from Wikipedia)
  • 11. BDD frameworks for Java Cucumber Concordion JBehave Spock (groovy) Easyb (groovy)
  • 12. Example of Feature file Not very clear scenario: When user click on button Then everything works
  • 13. Selenium + Cucumber: how to start?
  • 14. What You need to know about Cucumber 1. Maven dependencies to Cucumber 2. Feature file under “src/test/resources/../features/../” 3. Cucumber test runner 4. Implemented steps
  • 15. Step 1. Prepare Yourself. Tools 1. IntelliJ IDEA 2. JDK 1.8 3. Maven 4. Set environment variables for JAVA and Maven (for Windows) 5. Install plugins for IntelliJ “Cucumber for Java” if not installed 6. Ready to go! www.itarray.net - Lesson 1
  • 16. Step 2. Maven dependencies 1. What is pom.xml? 2. Required dependencies for Cucumber and Selenium
  • 18. Cucumbers features 1. Tags (@Smoke) 2. Scenario outlines (Tables)
  • 20. First Selenium scenario ...So, what is Automotion? Possibility to run any of existing web / mobile drivers from one place Useful utils for web and mobile automation: Scrolling, swiping, tapping, waiting, end so on Manipulating by Android settings during test run Validation of the language on web / mobile page Tools for performing REST API testing Testing of responsive design
  • 22. Responsive design How to test next things like:
  • 23. Existing services - Image recognition (not very effective) - High costs - Not easy integration with existing test framework - Dependendencies to other services - Specific syntax
  • 24. What we need? - Easy integration into existing framework - Working with Selenium tests - Readable syntax - Fast and accurate results
  • 25. Automotion Responsive UI Validator We can do: - Define approximate or precise values for measuring of the sizes - Offsets and margins - Comparison with offsets of other elements - Overlapping (if inside or outside of specific elements) - Correct alignment - Different units for measuring ResponsiveUIValidator uiValidator = new ResponsiveUIValidator(driver); boolean result = uiValidator.init() .findElement({rootEelement}, "Name of element") .sameOffsetLeftAs({element} "Panel 1") .sameOffsetLeftAs({element} "Button 1") .sameOffsetRightAs({element} "Button 2") .sameOffsetRightAs({element}, "Button 3) .withCssValue("border", "2px", "solid", "#FBDCDC") .withCssValue("border-radius", "4px") .withoutCssValue("color", "#FFFFFF") .sameSizeAs({list_elements},) .insideOf({element}, "Container") .notOverlapWith({element}, "Other element") .withTopElement({element}, 10, 15) .changeMetricsUnitsTo(ResponsiveUIValidator.Units.PERCENT) .widthBetween(50, 55) .heightBetween(90, 95) .drawMap() .validate(); uiValidator.generateReport();
  • 27. Which platforms are supported
  • 28. Summarise BDD Specification by example Cucumber + Selenium Visual UI testing
  • 29. Questions? Please, ask me what is unclear for You

Editor's Notes

  • #3: Today I will show You some screenshots, charts, videos and live examples.
  • #4: Ask about is people agree with it. If not - ask why.
  • #7: Ask people if they like it and if they do the same reporting on the project
  • #8: Joke about many text.
  • #17: Pom file is the main Maven file that defines how we want to run maven goals, which dependencies to use.