2. About Me
• Lead Technical Evangelist at Perfecto
• Blogger and Speaker
• http://mobiletestingblog.com
• https://www.infoworld.com/author/Eran-
Kinsbruner/
• 18+ Years in Development & Testing
• Author of The Digital Quality Handbook
To get your copy of the book, come by the Perfecto Booth
3. Agenda
Learning Objectives:
• What is BDD and its key advantages and disadvantages.
• What are the material differences in test automation between Mobile, Web and Responsive apps.
• How to build a BDD project that is based on a page object model that runs in parallel on various platforms.
Tutorial Outline:
• An Intro to BDD
• What is driving a shift to such software development practice
• Who are the stakeholders that make BDD process work
• What are the differences between BDD and formal software development life cycle
• BDD 101
• What are feature files, step definition (glue code), scenarios, background, DDT, Tagging, and a BDD project structure
(Gherkin)
• Working with mobile and web objects and page object model within BDD
• Available tools and frameworks in the market that supports BDD (e.g. Serenity BDD, Cucumber, Protractor, and more)
• BDD in the Cloud (quantum project reference)
• Configure a BDD project for responsive web and mobile apps to run in parallel in the cloud
• Leverage reporting to maximize quality productivity
• BDD and Visual Analysis
• Quantum & Applitools how to
• BDD Markdown Framework – Gauge.org
7. 1
2
3 4
Approaches to DevOps Testing
Coverage
DailySprint
Smoke
Full
Coverage
before
Robustness
Robustness
Before
Coverage
Most of the market
• Sprint level execution
• Half-way to coverage
1. Create some scripts
2. Create more scripts
3. Even more scripts
4. (Try to) run them daily
1
2
3
4
1. Create few robust scripts
2. Make sure they run daily
3. Slowly add more scripts
1. Maintain stability & visibility
4. Add more scripts
• Too many failures
• Too much time spent on analysis
9. A Day in A Life – Covering Real Environments Should be Part of Your Coverage Planning
12/3/2016
System/Network Conditions
• Battery not full
• Location Services Active
• 4G Network/No Wi-Fi
• System level is important
Background Notifications
• Messages
• News app notifications
• Sport apps notifications
• Emails alerts
• Social (Facebook) alerts
21. BDD Definition – By Wikipedia
• In software engineering, behavior-driven development (BDD) is a software development
process that emerged from test-driven development (TDD).[1][2][3][vague]Behavior-driven development
combines the general techniques and principles of TDD with ideas from domain-driven
design and object-oriented analysis and design to provide software development and management
teams with shared tools and a shared process to collaborate on software development.[1][4]
• BDD is largely facilitated through the use of a simple domain-specific language (DSL) using natural
language constructs (e.g., English-like sentences) that can express the behavior and the expected
outcomes. Test scripts have long been a popular application of DSLs with varying degrees of
sophistication. BDD is considered an effective technical practice especially when the "problem space"
of the business problem to solve is complex.
24. BDD, The 3 Amigos and TDD
Definition
• Three amigos refers to the primary perspectives to examine an increment
of work before, during, and after development. Those perspectives are:
• Business - What problem are we trying to solve?
• Development - How might we build a solution to solve that problem?
• Testing - What about this, what could possibly happen?
27. Advantages & Disadvantages of Using BDD
Expected Benefits
• Builds a shared understanding about the intent of an increment
of work.
• Easy ramp up from a skillset perspective
• Multi language & IDE support (Java, Ruby)
• Various mobile and web supporting frameworks
• Identifies misunderstandings and confusion early and allows
learning to happen sooner in the delivery of an increment of
work.
• Provides a reasonable guard rail for the number of people who
should be involved in discussions about any given increment of
work.
28. Advantages & Disadvantages of Using BDD
Disadvantages & Common Pitfalls
• While syncing various personas, Doesn’t employ traditional SW
development processes
• Dependent on available coding skillset within the team (step definition
development)
• Maintenance and cross platform robust test coding is often a challenge
• Limiting three amigo discussions to only three people. If there are other
stakeholders who are relevant to a particular increment of work, include
them in the discussion.
• Three amigo discussions become regularly scheduled meetings and are
treated as another ceremony for the team to do instead of as a handy
guide of what perspectives should be included in a discussion about a
particular increment of work.
29. Here is a sample Gherkin document:
Feature: Refund item
Scenario: Jeff returns a faulty microwave
Given Jeff has bought a microwave for $100 And he has a receipt
When he returns the microwave
Then Jeff should be refunded $100
In Gherkin, each line that isn't blank has to start with a Gherkin keyword, followed by any text you like.
The main keywords are:
• Feature
• Scenario
• Given, When, Then, And, But (Steps)
• Background
• Scenario Outline
• Examples
There are a few extra keywords as well:
• """ (Doc Strings)
• | (Data Tables)
• @ (Tags)
• # (Comments)
Gherkin Syntax
https://cucumber.io/docs/reference
30. Gherkin Syntax – Features, Scenario’s & Steps
• Features describe in an high level a single feature of the system
e.g. “Login to the app” and to group to it set of related scenario’s
• Scenario’s are specific business rules related to the feature
• Describe an initial context
• Describe an event
• Describe an expected outcome
• Steps are usually defined using Given, When and Then and
construct the body of the scenario.
• There are some recommended practices around the # of Given and When
within a single scenario. To many == split your scenario
• Then usually would describe the expected outcome followed by an Assertion
or validation (Object based or Visual based).
31. Diving Into Gherkin – Use of Background’s
Instead of repeating Given steps across multiple scenario’s,
Include the repetitive Given/s in the Background section
33. Diving Into Gherkin – Scenario’s vs. Scenario Outline
A container for a table
34. Doc Strings and Data Tables
Doc strings (“””) are used to pass large string of text to a step definition
Data tables are used to pass a list of values to a step definition
35. Tagging and RTDD
Use of tags (@) above Features, Scenarios allow classifying and
grouping what’s above the tag. E.g. – a tag placed above a
Feature means that all scenarios below that feature get the tag.
41. BDD Test Management
Teams can chose commercial tools (TestRail e.g.) or embed BDD
into their Build/CI tool chain
• Build Tools
• Gradle, Maven
• CI Tools
• Jenkins, Team City, Bamboo
42. BDD for iOS – XCFit & Cucumberish
XCFit is a pure Swift implementation to support BDD inside XCode projects. It also gives
XCode templates to get started with BDD, Page Object Pattern and Protocol Oriented
pattern. XCFit has some pre-defined steps inside Swift frameworks but the quick benefit
comes from XCode templates. More information on Protocol Oriented BDD here. Again
major drawback is we cannot write or execute .feature files and lacks many core
cucumber features like tags, filtering features.
Cucumberish is a test framework that can be used to write features in Gherkin format and
can be executed from XCode. Cucumberish is written Objective-C and uses Objective-C
Gherkin parser from Cucumber repository. Its great to be able to execute Gherkin feature files
from XCode but Cucumberish has some bugs and needs workarounds for most cases. Also
it’s a bit tricky to introduce Objective-C dependency in the fully Swift Project. Cucumberish
can be imported to UI Test target using CocoaPods or Carthage.
46. Architecture
Perfecto Report
Object Spy
Repository
file
Live dashboard
Cucumber BDD test
Test Java code
testNG
Perfecto utils
Pre define steps
User
advance
code
Script creation Execute Report
Access to devices
Remote debugging
Real devices and browsers
Manual services
47. BDD – Cucumber
Test -Feature files
Pre define steps
by Perfecto
Logical steps
created by
customers
48. BDD – Steps definition
Test -Feature files
Pre define steps
by Perfecto
Logical steps
created by
customers
50. BDD – components
Test -Feature files
Pre define steps
by Perfecto
(Low Level)
Logical steps
created by
customers
• Standard BDD – cucumber
• Auto complete using standard Cucumber
plugin
Requirements from user:
• Identify elements and add to
repository
• Build flow by using low level and
logical functions
51. code– components
Test -Feature files
Pre define steps
by Perfecto
Logical steps
created by
customers
• Customer code
• Standard java code
• Focused only on the test actions and
validations
• QAF manage
• Driver init
• getDriver() – provide the exiting driver
• Object repository
• Predefine functions (sendKey, assertText,…)
• Integration with DigitalZoom™ execution and
steps (no code need to be added)
• Perfecto
• Utils code with specific commands like (WT,
swipe)