test automation framework with bdd and cucumber
TRANSCRIPT
BDD and Cucumber based Test Automation
FrameworksHarsh [email protected]
Software ArchitectRhoynar 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 and
Test Automation Solutions• 12+ years of Software Engineering Experience
About Rhoynar Software ConsultingFounded in 2015, providing QA automation and Continuous Delivery Services for clients in Denver/Boulder area.
Contact Us:Web: www.rhoynar.comPh.: +1-855-5-RHOYNAREmail: [email protected]
• Consulting: Application Development, QA Automation and DevOps
• Staffing: Highly Experienced Candidates
• Training: 3-5 days customized training courses
About This Presentation: Objectives• Motivation and Background: • Open-source initiatives from Rhoynar• Continuous Integration Infrastructure• Email Notification Verification• AutoTestR – Automatic Page Object Generation
• BDD and Cucumber• Overview of BDD – Behavior Driven Development Model and Cucumber• Integration of Selenium WebDriver, Page Objects and Models Design Pattern• BDD and Test 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 Object Auto 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 Based Test 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!
- Example Test 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 to Verify 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• Extends Test Driven Development to cover Business
Acceptance Tests
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 with Web 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 ConnectedWhen I load the buildThen 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 ConnectedWhen I load the buildAnd I reset the deviceThen 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.comPh.: +1-855-5-RHOYNAR
Email: [email protected]
ConsultingQA Automation, DevOps
and Application
Development
StaffingHighly qualified and
tech-screened candidates
TrainingCustomized onsite
training events on latest technologies