BDD and Cucumber based Test Automation Frameworks Harsh Murari harsh@rhoynar.com Software Architect Rhoynar Software Consulting, Boulder, CO www.rhoynar.com Presented At SQUAD Meetup at Denver, CO, Oct 11, 2016
Job Announcements Oct 11, 2016 • Senior PHP Developer: PHP, LAMP, CodeIgnitor,WebStorm • QA Automation Engineer (Boston Area): Java,TestNG, Selenium WebDriver
About Me • Co-founder and Software Architect at Rhoynar Software Consulting (www.rhoynar.com) • Working on Application Development, QA Automation andTest Automation Solutions • 12+ years of Software Engineering Experience
About Rhoynar Software Consulting Founded in 2015, providing QA automation and Continuous Delivery Services for clients in Denver/Boulder area. Contact Us: Web: www.rhoynar.com Ph.: +1-855-5-RHOYNAR Email: contact@rhoynar.com • Consulting: Application Development, QA Automation and DevOps • Staffing: Highly Experienced Candidates • Training: 3-5 days customized training courses
AboutThis Presentation: Objectives • Motivation and Background: • Open-source initiatives from Rhoynar • Continuous Integration Infrastructure • Email NotificationVerification • AutoTestR – Automatic Page Object Generation • BDD and Cucumber • Overview of BDD – Behavior Driven Development Model and Cucumber • Integration of SeleniumWebDriver, Page Objects and Models Design Pattern • BDD andTest Automation Best Practices • BDD Demo
Open Source Initiatives From Rhoynar : https://github.com/Rhoynar
Continuous Integration Infrastructure https://github.com/Rhoynar/ci-infra
CI Infra Workflow https://github.com/Rhoynar/ci-infra
AutoTestR – Page ObjectAuto Generation • AutoTestR uses node.js framework to parse the DOM for the page and generate corresponding test object code. https://github.com/Rhoynar/AutoTestR
AutoTestR Graph BasedTest Case Generation - Each node represents a page-object (or rather business object) - Each node specifies what are its exported interfaces, what are its next states - Based on this graph, AutoTestR auto-generates test case skeletons as well! - ExampleTest Cases: - Login->Unregistered Page - Login->Main Page->CreateUser->End - Login->Main Page->SearchUser->End - Login->Main Page->DeleteUser->End - Login->Main Page->Unregistered Page https://github.com/Rhoynar/AutoTestR
EmailVerify:Verify Email Notification Receipt UseCase - Web Application Sends a Notification/Email to Users - Test Automation Wants toVerify if Email has been received? - Email with certain Subject Line has been received? - Email with certain content has been received? Etc https://github.com/Rhoynar/EmailVerify Use EmailVerify Library - Simple to use: startMonitor(), verify(), stopMonitor() - Multiple variations of use-cases and regular expression parsing support!
BDD/Cucumber based QA- Automation Framework https://github.com/Rhoynar/qa-automation • Project for barebones QA Automation Development Using: • Java • BDD • Cucumber • TestNG • Maven
What is BDD (Behavior Driven Development)? • BDD Keeps Business Behavior in sync with Software Development • ExtendsTest Driven Development to cover BusinessAcceptanceTests
How can I write tests without actual code? • BDD Uses Simple English Syntax (Gherkin) • BDD uses example based ‘Scenarios’ • Each ‘Scenario’ is noted in the form of ’Given’, ‘When’, ‘Then’
Outside In Approach • Start with a conversation • Determine the business value • Provide Examples of use
BDD Example: Simple Login Scenario Step Definitions
Does this only work withWeb Based Applications? • BDD can be work with any type of application! • We recently used BDD to load builds onto Android Device. Scenario: Load Android Build onto device Given Device is Connected When I load the build Then Device is detected in ADB Automatic Conversion to Code public void device_is_connected() {…} public void i_load_the_build() {…} public void device_detected_in_adb() {…}
Building Blocks of Scenarios • BDD Allows to build on top of existing scenarios easily • Existing step-defs can be re-used, only new steps need to be written • Less Code Repetition – better regression framework Scenario: Load Android Build onto device Given Device is Connected When I load the build And I reset the device Then Device is detected in ADB With only one additional step, I have a new test case public void device_is_connected() {…} public void i_load_the_build() {…} public void i_reset_device(){…} public void device_detected_in_adb() {…}
Demo • Yahoo Login Example • Source Code: https://github.com/Rhoynar/qa-automation
Summary • BDD minimizes communications, hides implementation details and provides robust regression tests. • BDD Provides Building blocks of scenarios and step-definitions, so incremental test can be written easily.
Contact Us: Rhoynar Software Consulting Web: www.rhoynar.com Ph.: +1-855-5-RHOYNAR Email: contact@rhoynar.com Consulting QA Automation, DevOps and Application Development Staffing Highly qualified and tech- screened candidates Training Customized onsite training events on latest technologies

Test Automation Framework with BDD and Cucumber

  • 1.
    BDD and Cucumberbased Test Automation Frameworks Harsh Murari harsh@rhoynar.com Software Architect Rhoynar Software Consulting, Boulder, CO www.rhoynar.com Presented At SQUAD Meetup at Denver, CO, Oct 11, 2016
  • 2.
    Job Announcements Oct11, 2016 • Senior PHP Developer: PHP, LAMP, CodeIgnitor,WebStorm • QA Automation Engineer (Boston Area): Java,TestNG, Selenium WebDriver
  • 3.
    About Me • Co-founderand Software Architect at Rhoynar Software Consulting (www.rhoynar.com) • Working on Application Development, QA Automation andTest Automation Solutions • 12+ years of Software Engineering Experience
  • 4.
    About Rhoynar SoftwareConsulting Founded in 2015, providing QA automation and Continuous Delivery Services for clients in Denver/Boulder area. Contact Us: Web: www.rhoynar.com Ph.: +1-855-5-RHOYNAR Email: contact@rhoynar.com • Consulting: Application Development, QA Automation and DevOps • Staffing: Highly Experienced Candidates • Training: 3-5 days customized training courses
  • 5.
    AboutThis Presentation: Objectives •Motivation and Background: • Open-source initiatives from Rhoynar • Continuous Integration Infrastructure • Email NotificationVerification • AutoTestR – Automatic Page Object Generation • BDD and Cucumber • Overview of BDD – Behavior Driven Development Model and Cucumber • Integration of SeleniumWebDriver, Page Objects and Models Design Pattern • BDD andTest Automation Best Practices • BDD Demo
  • 6.
    Open Source Initiatives FromRhoynar : https://github.com/Rhoynar
  • 7.
  • 8.
  • 9.
    AutoTestR – Page ObjectAutoGeneration • AutoTestR uses node.js framework to parse the DOM for the page and generate corresponding test object code. https://github.com/Rhoynar/AutoTestR
  • 10.
    AutoTestR Graph BasedTestCase Generation - Each node represents a page-object (or rather business object) - Each node specifies what are its exported interfaces, what are its next states - Based on this graph, AutoTestR auto-generates test case skeletons as well! - ExampleTest Cases: - Login->Unregistered Page - Login->Main Page->CreateUser->End - Login->Main Page->SearchUser->End - Login->Main Page->DeleteUser->End - Login->Main Page->Unregistered Page https://github.com/Rhoynar/AutoTestR
  • 11.
    EmailVerify:Verify Email NotificationReceipt UseCase - Web Application Sends a Notification/Email to Users - Test Automation Wants toVerify if Email has been received? - Email with certain Subject Line has been received? - Email with certain content has been received? Etc https://github.com/Rhoynar/EmailVerify Use EmailVerify Library - Simple to use: startMonitor(), verify(), stopMonitor() - Multiple variations of use-cases and regular expression parsing support!
  • 12.
    BDD/Cucumber based QA- AutomationFramework https://github.com/Rhoynar/qa-automation • Project for barebones QA Automation Development Using: • Java • BDD • Cucumber • TestNG • Maven
  • 13.
    What is BDD(Behavior Driven Development)? • BDD Keeps Business Behavior in sync with Software Development • ExtendsTest Driven Development to cover BusinessAcceptanceTests
  • 14.
    How can Iwrite tests without actual code? • BDD Uses Simple English Syntax (Gherkin) • BDD uses example based ‘Scenarios’ • Each ‘Scenario’ is noted in the form of ’Given’, ‘When’, ‘Then’
  • 15.
    Outside In Approach •Start with a conversation • Determine the business value • Provide Examples of use
  • 16.
    BDD Example: Simple LoginScenario Step Definitions
  • 17.
    Does this onlywork withWeb Based Applications? • BDD can be work with any type of application! • We recently used BDD to load builds onto Android Device. Scenario: Load Android Build onto device Given Device is Connected When I load the build Then Device is detected in ADB Automatic Conversion to Code public void device_is_connected() {…} public void i_load_the_build() {…} public void device_detected_in_adb() {…}
  • 18.
    Building Blocks ofScenarios • BDD Allows to build on top of existing scenarios easily • Existing step-defs can be re-used, only new steps need to be written • Less Code Repetition – better regression framework Scenario: Load Android Build onto device Given Device is Connected When I load the build And I reset the device Then Device is detected in ADB With only one additional step, I have a new test case public void device_is_connected() {…} public void i_load_the_build() {…} public void i_reset_device(){…} public void device_detected_in_adb() {…}
  • 19.
    Demo • Yahoo LoginExample • Source Code: https://github.com/Rhoynar/qa-automation
  • 20.
    Summary • BDD minimizescommunications, hides implementation details and provides robust regression tests. • BDD Provides Building blocks of scenarios and step-definitions, so incremental test can be written easily.
  • 21.
    Contact Us: Rhoynar SoftwareConsulting Web: www.rhoynar.com Ph.: +1-855-5-RHOYNAR Email: contact@rhoynar.com Consulting QA Automation, DevOps and Application Development Staffing Highly qualified and tech- screened candidates Training Customized onsite training events on latest technologies