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

PDF
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
PDF
Introducing Keyword-Driven Test Automation
PDF
Introducing Keyword-driven Test Automation
PDF
Keyword Driven Testing
PPTX
Real world selenium resume which gets more job interviews
DOCX
Test Engineer CV for 3+ exp
DOCX
Deepika engineer
DOC
Resume
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
Introducing Keyword-Driven Test Automation
Introducing Keyword-driven Test Automation
Keyword Driven Testing
Real world selenium resume which gets more job interviews
Test Engineer CV for 3+ exp
Deepika engineer
Resume

What's hot (20)

PPT
Test Automation Framework Designs
PPTX
A Test Automation Framework
PPTX
Software Automation Testing Introduction
PPTX
Keyword-driven Test Automation Framework
PPTX
Test Automation
PPTX
Automation Testing with Test Complete
PDF
Automated Testing
PDF
Selenium Automation Testing Interview Questions And Answers
PPTX
Test complete, work done so far
PPTX
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
DOCX
Realtime selenium interview questions
DOCX
Ajit jadhav automation_qa_4_ yrs
ODP
Jbossworld Presentation
PPT
Introduction of exception in vb.net
PPT
Automation framework
PDF
Shashank_Venkataramanacharya
DOC
Automation using ibm rft
PDF
Open Source Software Testing Tools
PPT
Test Automation Framework Development Introduction
PPT
Hybrid Automation Framework Development introduction
Test Automation Framework Designs
A Test Automation Framework
Software Automation Testing Introduction
Keyword-driven Test Automation Framework
Test Automation
Automation Testing with Test Complete
Automated Testing
Selenium Automation Testing Interview Questions And Answers
Test complete, work done so far
Software-automation-testing-course-navi-mumbai-software-automation-testing-co...
Realtime selenium interview questions
Ajit jadhav automation_qa_4_ yrs
Jbossworld Presentation
Introduction of exception in vb.net
Automation framework
Shashank_Venkataramanacharya
Automation using ibm rft
Open Source Software Testing Tools
Test Automation Framework Development Introduction
Hybrid Automation Framework Development introduction
Ad

Similar to Smart acceptance GUI tests with Selenium (20)

PDF
Acceptance Test-driven Development with Cucumber-jvm
PDF
cucumber harpal.pdf
PPTX
Bdd with Cucumber and Mocha
PDF
Selenium with Cucumber
PDF
Selenium with Cucumber
PDF
Selenium with Cucumber
PPTX
BDD using Cucumber JVM
PDF
Mastering BDD with Cucumber & Java for Test Automation
PPT
Behavior Driven Development by Example
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
PPTX
BDD from QA side
PDF
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
PPTX
Cucumber_Training_ForQA
PPTX
Automation test framework with cucumber – BDD
PPTX
Sexy Using Cucumber - BDD in your project
PDF
Cucumber Basics.pdf
PPTX
Tutorial on the integration of Selenium with cucumber for experts and fresher’s
PDF
BDD in Java using Cucumber
PDF
Master Cucumber cheat sheet for testing .pdf
PPTX
Introduction to the functional test automation with cucumber and selenium
Acceptance Test-driven Development with Cucumber-jvm
cucumber harpal.pdf
Bdd with Cucumber and Mocha
Selenium with Cucumber
Selenium with Cucumber
Selenium with Cucumber
BDD using Cucumber JVM
Mastering BDD with Cucumber & Java for Test Automation
Behavior Driven Development by Example
Automated Testing with Cucumber, PhantomJS and Selenium
BDD from QA side
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Cucumber_Training_ForQA
Automation test framework with cucumber – BDD
Sexy Using Cucumber - BDD in your project
Cucumber Basics.pdf
Tutorial on the integration of Selenium with cucumber for experts and fresher’s
BDD in Java using Cucumber
Master Cucumber cheat sheet for testing .pdf
Introduction to the functional test automation with cucumber and selenium
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.