SlideShare a Scribd company logo
1 of 36
Agile Testing, Test
Automation & BDD
OCTOBER 25, 2016
SINGAPORE
ORGANIZED BY TESTINGMIND
BDD + Mobile
Ben Ishiyama-Levy
Agile Technologist / .Net Pianist / Xamarin Evangelist / Driven Cucumberist
www.xamariners.com
www.meetup.com/SingaporeMobileDev
ben@xamariners.com
A programmer is going out for a stroll one evening.
His wife asks him to swing by the store and pick up a
gallon of milk, and if they had eggs, to get a dozen.
He returned with 12 cartons of milk and said:
"They had eggs."
What is BDD?
“Behaviour Driven Development is a outside-in, pull-based, multiple-
stakeholder, multiple-scale, high-automation, agile methodology.
It describes a cycle of interactions with well-defined outputs,
resulting in the delivery of working, tested software that matters.”
It’s a bunch of tiny stories, using a particular grammatical structure.
It’s finding places of misunderstanding, and filling it with understanding
It’s a conversation, captured.
BDD is not solely beneficial to developers,
but to all stakeholders associated with the project:
Business / Clients
Users
Testers
Developers
Designers
Who is BDD for?
UX Architects
Business Analysts
Scrum Masters
Project Managers
Project Owners
• Build the application layers atomically.
• The first demonstrable deliverable will only be
ready when most layers are ready
• Subsequent long iterations = risk increase
• The entire cake must be baked before the
customer realizes that the cake is not the one
that’s wanted
• In the best case, customer gets what was
asked for, but not what was in mind (vanilla
instead of chocolate, sponge cake instead of
profiteroles)
Horizontal User Stories
If given the chance to sample one slice, the discrepancies would have been flagged early on
It is difficult to prioritize horizontal stories:
For example, during the initial pilot roll-out of ATM machines,
most bank customers have asked for ability to:
• Withdraw their money 24/7
• Check their balance
Based on marketing research, withdrawing the cash would
accounts for over 90% of intended usage of ATM
It could have been easily achieved with two vertical stories (epics) and delivered to the market early:
“As a user of ATM, I want to withdraw cash from my bank account”
“As a user of ATM, I want to get the current balance of my bank account”
Knowing this fact, the prudent approach would be to release the first version of ATM, only with ability
to dispense the cash (and we can call it “the cash machine”). The bank would be able to release it to
the market much sooner (3-6 months) rather than waiting to implement the full functionality (12-15
months)
Horizontal User Stories
Rather than building the system layer by layer,
in which case the end user will only have a
chance to experience the system when fully
done,
the idea is to build it, user story by user story,
where each one will cross all horizontal layers.
Vertical user story is not a scenario:
One user story may contain many positive and negative scenarios,
and they should be part of acceptance criteria for that user story.
From the user story mentioned above, we can derive at least ten
positive scenarios, and all of them at the end will result in satisfied
user walking away from ATM with $100 cash,
And negative scenarios resulting in user being rejected withdrawal
from their account.
Vertical User Stories
Positive Scenarios:
• User enters the wrong password
• User enters the amount larger than the daily withdrawal limit
• User enters the amount larger than the her account balance
Similarly we can come up with five times more negative
Vertical User Stories
Vertical stories are written in a unambiguous language that is easily understood by all stakeholders of the system,
and encourages the conversation between them.
All those scenarios mentioned above can be easily communicated between the product owner and the team
(developer and tester), and specified as an acceptance criteria
Negative Scenarios:
• Wrong bank card
• Expired bank card
• Customer forgot her password
• Account in negative balance
• ATM has no money
Unit Tests confirm that you built it right (INSIDE OUT)
Acceptance Tests vs. Unit and Integration Tests
Acceptance Tests confirm that you build the right thing (OUTSIDE IN)
Cucumber is a software requirements and testing tool that enables a style of
Development, Behaviour Driven Development, that builds on the principles of test-driven
development
Test-driven development is a core principle and practice of extreme
programming and has since been adopted by many other agile life cycles
Test-driven development is supported by a few key ideas:
• No production code is written except to make a failing test pass
• This test case should be written by the developer and customer together
• The tests should be automated so we are encouraged to run them all
the time: they provide insight into the progress being made
From TDD to BDD
These tests are called acceptance tests because they document what
behaviours the customer will find acceptable in terms of the final functionality of
the system
They are different from unit tests:
• Unit tests are for developers and help you “build the thing right”
• Acceptance tests are for customers and help you “build the right thing”
• Acceptance tests are higher-level constructs that can be used to guide
developers down the path of writing unit tests that will get them to their goal
• Cucumber helps you write acceptance tests in the customer’s language
• This encourages the customer to participate in a task they might
otherwise skip
From TDD to BDD
Behaviour-driven development expands on test-driven development by:
• Formalizing its best practices
• In particular the perspective of working from the outside-in
• Start work with failing customer acceptance tests
• Write tests such that they serve as examples that anyone can read
• Both to understand a requirement and to understand how to
generate more requirements
• Develop a process to encourage our customers to get involved with
writing these requirements and to stay involved
• Aim to develop a shared, ubiquitous language for talking about the
system
From TDD to BDD
Make sure everyone (including your customers) speak about the system, its
requirements and its implementation, in the same way:
• “The case management system tracks the cases handled by service reps”
• The whole team will now talk about “service reps” and “cases”
• Any attempt to change that to, say, “workers” and “jobs” will be rejected
• We want to see the same terms used to discuss the system to be present in the
requirements, design documents, code, tests, etc.
• Cucumber helps with this process since, as we shall see, it ties together the
tests with the actual code of the system
Ubiquitous Language
Feature: Sign up
Sign up should be quick and friendly
Scenario: Successful sign up
New users should get a confirmation e-mail and be greeted personally
Given I have chosen to sign up
When I sign up with valid details
Then I should receive a confirmation email
And I should see a personalized greeting message
• Acceptance tests refer to features
• Features are explained by scenarios
• Scenarios consist of steps
• The spec is written in natural language in a plain-text file
• BUT the spec is executable!
• Cucumber can guide us into turning the language of each step into an executable test case that calls
our systems and can then either pass or fail
• The way it does this is actually designed to get customers and developers working together
Typical Cucumber Acceptance Test
Cucumber is a command line tool that processes text files that contain features
looking for scenarios that can be executed against your system
It makes use of a bunch of conventions about how the files are named and
where they live to make it easy to get started
Each scenario is a list of steps that describe the pre-conditions, actions, and
post-conditions of each scenario; if each step executes without error, the
scenario is marked as having passed
At the end of a run, Cucumber will report how many scenarios passed; if
something fails, it provides information about what failed so the developer
can make progress
Features, scenarios, and steps are written in language called Gherkin
How Cucumber Works
To turn natural language into executable specifications:
• Each step must be accompanied by a step definition
• Most steps will gather input and then delegate to a framework that is
specific to your application domain in order to make calls on your framework
• For instance, TestCloud is a framework for automating interactions with Mobile devices
• If your application is a mobile app, then your step definitions will most likely
delegate to TestCloud to make sure that your application is loaded and
then stepped through the scenario (“tap this button”, enter “Ben” in the “first name”
field, etc.)
• Your step definitions will likely be short and easy to maintain
How Cucumber Works
The key to Cucumber is the mapping between steps and step
definitions.
That’s “where the magic happens” and allows your non-technical
customers to write specifications that will actually invoke and test
the system that you are building!
How Cucumber Works
Gherkin is the language used to write features, scenarios, and steps
The purpose of the language is to help us write concrete requirements
Consider:
- Customers should be prevented from entering invalid credit card details.
Versus:
- If a customer enters a credit card number that isn’t exactly 16 digits long,
when they try to submit the form, it should be redisplayed with an error
message advising them of the correct number of digits.
The latter is much more testable; we want to remove as much ambiguity as
possible in our requirements since ambiguity is a proven source of errors
Gherkin is designed to create more concrete requirements
Gherkin Language
Feature: Feedback when entering invalid credit card details
Background: (Applies to all Scenarios for that feature)
Given I have chosen an item to buy
And I am about to enter my credit card number
Scenario: Credit card number too short (Scenario Definition)
When I enter a card number that is less than 16 digits long
And all the other details are correct
And I submit the form
Then the form should be redisplayed
And I should see a message advising me of the correct number of digits
Gherkin Format and Syntax
The feature keyword is used to group a set of tests (scenarios)
The text on the same line as the keyword is considered the name of
the feature
All text between the initial line and a line that starts with Scenario,
Background, or Scenario Outline is considered part of a feature’s
description
Feature
Think of your Users
In order to identify features in your system, you can a “feature injection template”:
In order to <meet some goal>
As a <type of user>
I want <a feature>
The functional requirements of a system are determined by asking the
Questions:
• For each type of user
• What goals are they trying to achieve?
• What tasks must they perform to achieve those goals
• How does our system support those tasks?
Coming up with Features
To express the behaviour of our system, we attach one or more scenarios
with each feature
It is typical to see 5 to 20 scenarios per feature to completely specify all
the behaviours we’d like to see around a particular feature
Scenarios follow a pattern:
• Configure the system
• Have it perform a specific action
• Verify that the new state of the system is what we expected
• We start with a context, describe an action, and check the outcome
Scenario
Gherkin provides three keywords to describe contexts, actions, and outcomes:
• Given: establish context
• When: perform action
• Then: check outcome
Example:
Scenario: Withdraw money from account
Given I have $100 in my account
When I request $20
Then $20 should be dispensed
Scenario
You can add additional steps to the context, action, and outcome sections
using the keywords ‘And’ and ‘But’
They allow you to specify scenarios in more detail
Scenario: Attempt withdrawal using stolen card
Given I have $100 in my account
But my card is invalid
When I request $50
Then my card should not be returned
And I should be told to contact the bank
These keywords help increase the expressiveness of the scenario
Scenario
In creating scenarios, a key design goal (indeed requirement)
is that they must be stateless
• “Each scenario must make sense and be able to be executed
independently of any other scenario”
• You can’t have the success condition of one scenario depend on the fact that
some other scenario executed before it
• Each scenario creates its particular context, executes one thing, and tests
the result
Scenario
Having stateless scenarios provides multiple benefits:
• Tests are simpler and easier to understand
• You can run just a subset of your scenarios and you don’t have to worry
about your test set breaking
• Depending on your system, you might be able to run tests in parallel,
reducing the amount of time it takes to execute all of your tests
Scenario
BDD Tools: SpecFlow, Cucumber, FitNesse, Nbehave, PHPUnit,
Jbehave, Jasmine …
Runners: Ruby, JRuby , .NET, JavaScript, - map cukes to application
UI testing framework - Watir, Watin, Selenium, Capybara (headless),
anything that supports WebDriver, TestCloud …
Misc:
Open source, strong community support
Technology Stack
As BDD features file get transformed into an existing unit testing
framework executable, they play nice with any continuous
integration solution such as:
• TeamCity
• Team Services
• Jenkins
• BitRise
• …
The executable generated will provide human readable feedback,
such as:
Step: ‘When I click on the login button’ failed with error ‘invalid
username’
Automation
BDD + Mobile
BDD provides the only tests you need for your app, to achieve:
- well designed app
- well implemented
- over-engineering free
- high level test coverage
- highly maintainable codebase
BDD + Mobile
Mobile device fragmentation issue:
Impossible to predict how and app will behave on all the
combinations of:
• OS (iOS, Android, Windows phone)
• OS Version (iOS 6,7,8,9 – Android jellybean, ice cream
sandwich, nougat – Windows 8.1, UPW – Cyanogen Mod…)
• Device screen factor (phones, phablets, tablets, eqach with
their different sizes and dpi)
• Device Specs (ram, cpu, sensors…)
The app needs to be tested on each combinations to ensure it
runs as expected
BDD + Mobile
UI Tests
BDD Tests mimics the user interaction on devices in real time. All Mobile user interaction
such as tap, slide, zoom, scroll, etc… are available
Tests can be recorded with the help of a Test Recorder, that will ultimately generate the
interaction code (following manually the BDD specifications)
Or
The BDD specifications are execute by the test runner as such, using libraries that binds
steps keywords to test runner interaction
pros: closest to the user truth
cons: expensive (long time to run, cost)
BDD + Mobile
Acceptance Console Tests
User interaction is abstracted to the commands it triggers on the
underlying framework.
For instance, on a MVVM environment, the tests definitions would:
• Execute commands (that would execute when a user taps, scrolls,
navigates…)
• Assert the ViewModel properties (such as the text in the username and
password fields)
pros: cheap to run (fast execution)
cons: no UI layer, therefore not as close from truth
BDD + Mobile
Best Approach:
Write BDD specs once ( feature / scenarios / steps)
Target both UITest and ACT runners
Continuously run acceptance console tests (local / server on commit)
Run ad hoc ui tests (locally)
Run UI Tests Suite on dev complete (server on pre-merge)
Thank You! Questions?
ben@xamariners.com
Ben Ishiyama-Levy
Agile Technologist / .Net Pianist / Xamarin Evangelist / Driven Cucumberist
www.xamariners.com
www.meetup.com/SingaporeMobileDev

More Related Content

What's hot

Writing GREAT Agile User Stories
Writing GREAT Agile User StoriesWriting GREAT Agile User Stories
Writing GREAT Agile User StoriesAgileDad
 
Build the "right" regression suite using Behavior Driven Testing (BDT)
Build the "right" regression suite using Behavior Driven Testing (BDT)Build the "right" regression suite using Behavior Driven Testing (BDT)
Build the "right" regression suite using Behavior Driven Testing (BDT)Anand Bagmar
 
Agile Acceptance Criteria How To
Agile Acceptance Criteria How ToAgile Acceptance Criteria How To
Agile Acceptance Criteria How ToPayton Consulting
 
Agile User Stories
Agile User StoriesAgile User Stories
Agile User Storieskahgeh75
 
Invest In Good User Stories
Invest In Good User StoriesInvest In Good User Stories
Invest In Good User StoriesCraig Brown
 
Specification-by-Example: A Cucumber Implementation
Specification-by-Example: A Cucumber ImplementationSpecification-by-Example: A Cucumber Implementation
Specification-by-Example: A Cucumber ImplementationTechWell
 
Workshop - Writing Good User Stories
Workshop - Writing Good User Stories Workshop - Writing Good User Stories
Workshop - Writing Good User Stories Easy Agile
 
iMediaTrans Brochure - English Version, March 2013
iMediaTrans Brochure - English Version, March 2013iMediaTrans Brochure - English Version, March 2013
iMediaTrans Brochure - English Version, March 2013David Lee
 
The Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinThe Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinQA or the Highway
 
Making the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentMaking the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentQASymphony
 
Ensuring Your Technology Will Scale
Ensuring Your Technology Will ScaleEnsuring Your Technology Will Scale
Ensuring Your Technology Will Scalebasissetventures
 
Composing User Stories - Beginners Guide
Composing User Stories - Beginners GuideComposing User Stories - Beginners Guide
Composing User Stories - Beginners GuideRaja Soundaramourty
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsIosif Itkin
 
Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria An Nguyen
 
B4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriaB4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriab4usolution .
 

What's hot (19)

User stories in agile software development
User stories in agile software developmentUser stories in agile software development
User stories in agile software development
 
Writing GREAT Agile User Stories
Writing GREAT Agile User StoriesWriting GREAT Agile User Stories
Writing GREAT Agile User Stories
 
Build the "right" regression suite using Behavior Driven Testing (BDT)
Build the "right" regression suite using Behavior Driven Testing (BDT)Build the "right" regression suite using Behavior Driven Testing (BDT)
Build the "right" regression suite using Behavior Driven Testing (BDT)
 
Agile Acceptance Criteria How To
Agile Acceptance Criteria How ToAgile Acceptance Criteria How To
Agile Acceptance Criteria How To
 
Agile User Stories
Agile User StoriesAgile User Stories
Agile User Stories
 
Invest In Good User Stories
Invest In Good User StoriesInvest In Good User Stories
Invest In Good User Stories
 
User Stories
User StoriesUser Stories
User Stories
 
Specification-by-Example: A Cucumber Implementation
Specification-by-Example: A Cucumber ImplementationSpecification-by-Example: A Cucumber Implementation
Specification-by-Example: A Cucumber Implementation
 
Workshop - Writing Good User Stories
Workshop - Writing Good User Stories Workshop - Writing Good User Stories
Workshop - Writing Good User Stories
 
iMediaTrans Brochure - English Version, March 2013
iMediaTrans Brochure - English Version, March 2013iMediaTrans Brochure - English Version, March 2013
iMediaTrans Brochure - English Version, March 2013
 
Extreme programming
Extreme programmingExtreme programming
Extreme programming
 
The Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt EakinThe Art of Gherkin Scripting - Matt Eakin
The Art of Gherkin Scripting - Matt Eakin
 
Making the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentMaking the Move to Behavior Driven Development
Making the Move to Behavior Driven Development
 
Ensuring Your Technology Will Scale
Ensuring Your Technology Will ScaleEnsuring Your Technology Will Scale
Ensuring Your Technology Will Scale
 
Composing User Stories - Beginners Guide
Composing User Stories - Beginners GuideComposing User Stories - Beginners Guide
Composing User Stories - Beginners Guide
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
 
Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria
 
B4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriaB4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteria
 
User Story Writing Workshop
User Story Writing WorkshopUser Story Writing Workshop
User Story Writing Workshop
 

Viewers also liked

Xamariners: PRISM for Xamarin.Forms
Xamariners: PRISM for Xamarin.FormsXamariners: PRISM for Xamarin.Forms
Xamariners: PRISM for Xamarin.FormsXamariners
 
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...Xamariners
 
Portable Class Library Deep Dive
Portable Class Library Deep DivePortable Class Library Deep Dive
Portable Class Library Deep DiveJames Montemagno
 
Developing and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual StudioDeveloping and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual StudioXamarin
 
Say hello to Xamarin 3
Say hello to Xamarin 3Say hello to Xamarin 3
Say hello to Xamarin 3Xamarin
 
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világban
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világbanTervezz IoT architektúrát, avagy élet egy HTTP nélküli világban
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világbanGyörgy Balássy
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.FormsXamarin
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Xamarin
 

Viewers also liked (8)

Xamariners: PRISM for Xamarin.Forms
Xamariners: PRISM for Xamarin.FormsXamariners: PRISM for Xamarin.Forms
Xamariners: PRISM for Xamarin.Forms
 
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...
Karl Krukow - What's new and cool in xamarin test cloud - Xamarin Dev Days Si...
 
Portable Class Library Deep Dive
Portable Class Library Deep DivePortable Class Library Deep Dive
Portable Class Library Deep Dive
 
Developing and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual StudioDeveloping and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Visual Studio
 
Say hello to Xamarin 3
Say hello to Xamarin 3Say hello to Xamarin 3
Say hello to Xamarin 3
 
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világban
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világbanTervezz IoT architektúrát, avagy élet egy HTTP nélküli világban
Tervezz IoT architektúrát, avagy élet egy HTTP nélküli világban
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 

Similar to Xamariners - BDD + Mobile

User Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh VaradharajanUser Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh VaradharajanAgile Testing Alliance
 
Elite mindz introduction
Elite mindz introductionElite mindz introduction
Elite mindz introductionSimerjeet Singh
 
EliteMindz: Who are we? Where do we serve ? What are our products & services?
EliteMindz: Who are we? Where do we serve ? What are our products & services?EliteMindz: Who are we? Where do we serve ? What are our products & services?
EliteMindz: Who are we? Where do we serve ? What are our products & services?Simerjeet Singh
 
gtFace: Scrum (presentation)
gtFace: Scrum (presentation)gtFace: Scrum (presentation)
gtFace: Scrum (presentation)kostienko2
 
gtFace: Agile Scrum
gtFace: Agile ScrumgtFace: Agile Scrum
gtFace: Agile Scrumkostienko1
 
! Testing for agile teams
! Testing for agile teams! Testing for agile teams
! Testing for agile teamsDennis Popov
 
Dashlane Mission Teams
Dashlane Mission TeamsDashlane Mission Teams
Dashlane Mission TeamsDashlane
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductVMware Tanzu
 
Writing Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaWriting Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaHoa Le
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAraf Karsh Hamid
 
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.Test Evolve
 
Agile: Project methodology
Agile: Project methodologyAgile: Project methodology
Agile: Project methodologyTOMASZ KOSTIENKO
 
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo RiolWebinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo RiolatSistemas
 
How To Write User Stories
How To Write User StoriesHow To Write User Stories
How To Write User StoriesMichael Fallon
 
Behaviour driven development aka bdd
Behaviour driven development aka bddBehaviour driven development aka bdd
Behaviour driven development aka bddPrince Gupta
 
Continuous integration testing for automation needs and quality of the releases
Continuous integration testing for automation needs and quality of the releasesContinuous integration testing for automation needs and quality of the releases
Continuous integration testing for automation needs and quality of the releasesZado Technologies
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07Enthiosys Inc
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07Enthiosys Inc
 

Similar to Xamariners - BDD + Mobile (20)

User Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh VaradharajanUser Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh Varadharajan
 
Elite mindz introduction
Elite mindz introductionElite mindz introduction
Elite mindz introduction
 
EliteMindz: Who are we? Where do we serve ? What are our products & services?
EliteMindz: Who are we? Where do we serve ? What are our products & services?EliteMindz: Who are we? Where do we serve ? What are our products & services?
EliteMindz: Who are we? Where do we serve ? What are our products & services?
 
gtFace: Scrum (presentation)
gtFace: Scrum (presentation)gtFace: Scrum (presentation)
gtFace: Scrum (presentation)
 
gtFace: Agile Scrum
gtFace: Agile ScrumgtFace: Agile Scrum
gtFace: Agile Scrum
 
! Testing for agile teams
! Testing for agile teams! Testing for agile teams
! Testing for agile teams
 
Dashlane Mission Teams
Dashlane Mission TeamsDashlane Mission Teams
Dashlane Mission Teams
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
 
Writing Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaWriting Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance Criteria
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven Design
 
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.
The complete guide to BDD + Cucumber Best Practices and Anti-Patterns.
 
Agile user story mapping
Agile user story mappingAgile user story mapping
Agile user story mapping
 
Agile: Project methodology
Agile: Project methodologyAgile: Project methodology
Agile: Project methodology
 
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo RiolWebinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
 
How To Write User Stories
How To Write User StoriesHow To Write User Stories
How To Write User Stories
 
Behaviour driven development aka bdd
Behaviour driven development aka bddBehaviour driven development aka bdd
Behaviour driven development aka bdd
 
Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD
 
Continuous integration testing for automation needs and quality of the releases
Continuous integration testing for automation needs and quality of the releasesContinuous integration testing for automation needs and quality of the releases
Continuous integration testing for automation needs and quality of the releases
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07
 
Better Software Keynote The Complete Developer 07
Better Software Keynote  The Complete Developer 07Better Software Keynote  The Complete Developer 07
Better Software Keynote The Complete Developer 07
 

Recently uploaded

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Xamariners - BDD + Mobile

  • 1. Agile Testing, Test Automation & BDD OCTOBER 25, 2016 SINGAPORE ORGANIZED BY TESTINGMIND
  • 2. BDD + Mobile Ben Ishiyama-Levy Agile Technologist / .Net Pianist / Xamarin Evangelist / Driven Cucumberist www.xamariners.com www.meetup.com/SingaporeMobileDev ben@xamariners.com
  • 3. A programmer is going out for a stroll one evening. His wife asks him to swing by the store and pick up a gallon of milk, and if they had eggs, to get a dozen. He returned with 12 cartons of milk and said: "They had eggs."
  • 4. What is BDD? “Behaviour Driven Development is a outside-in, pull-based, multiple- stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.” It’s a bunch of tiny stories, using a particular grammatical structure. It’s finding places of misunderstanding, and filling it with understanding It’s a conversation, captured.
  • 5. BDD is not solely beneficial to developers, but to all stakeholders associated with the project: Business / Clients Users Testers Developers Designers Who is BDD for? UX Architects Business Analysts Scrum Masters Project Managers Project Owners
  • 6. • Build the application layers atomically. • The first demonstrable deliverable will only be ready when most layers are ready • Subsequent long iterations = risk increase • The entire cake must be baked before the customer realizes that the cake is not the one that’s wanted • In the best case, customer gets what was asked for, but not what was in mind (vanilla instead of chocolate, sponge cake instead of profiteroles) Horizontal User Stories If given the chance to sample one slice, the discrepancies would have been flagged early on
  • 7. It is difficult to prioritize horizontal stories: For example, during the initial pilot roll-out of ATM machines, most bank customers have asked for ability to: • Withdraw their money 24/7 • Check their balance Based on marketing research, withdrawing the cash would accounts for over 90% of intended usage of ATM It could have been easily achieved with two vertical stories (epics) and delivered to the market early: “As a user of ATM, I want to withdraw cash from my bank account” “As a user of ATM, I want to get the current balance of my bank account” Knowing this fact, the prudent approach would be to release the first version of ATM, only with ability to dispense the cash (and we can call it “the cash machine”). The bank would be able to release it to the market much sooner (3-6 months) rather than waiting to implement the full functionality (12-15 months) Horizontal User Stories
  • 8. Rather than building the system layer by layer, in which case the end user will only have a chance to experience the system when fully done, the idea is to build it, user story by user story, where each one will cross all horizontal layers. Vertical user story is not a scenario: One user story may contain many positive and negative scenarios, and they should be part of acceptance criteria for that user story. From the user story mentioned above, we can derive at least ten positive scenarios, and all of them at the end will result in satisfied user walking away from ATM with $100 cash, And negative scenarios resulting in user being rejected withdrawal from their account. Vertical User Stories
  • 9. Positive Scenarios: • User enters the wrong password • User enters the amount larger than the daily withdrawal limit • User enters the amount larger than the her account balance Similarly we can come up with five times more negative Vertical User Stories Vertical stories are written in a unambiguous language that is easily understood by all stakeholders of the system, and encourages the conversation between them. All those scenarios mentioned above can be easily communicated between the product owner and the team (developer and tester), and specified as an acceptance criteria Negative Scenarios: • Wrong bank card • Expired bank card • Customer forgot her password • Account in negative balance • ATM has no money
  • 10.
  • 11. Unit Tests confirm that you built it right (INSIDE OUT) Acceptance Tests vs. Unit and Integration Tests Acceptance Tests confirm that you build the right thing (OUTSIDE IN)
  • 12. Cucumber is a software requirements and testing tool that enables a style of Development, Behaviour Driven Development, that builds on the principles of test-driven development Test-driven development is a core principle and practice of extreme programming and has since been adopted by many other agile life cycles Test-driven development is supported by a few key ideas: • No production code is written except to make a failing test pass • This test case should be written by the developer and customer together • The tests should be automated so we are encouraged to run them all the time: they provide insight into the progress being made From TDD to BDD
  • 13. These tests are called acceptance tests because they document what behaviours the customer will find acceptable in terms of the final functionality of the system They are different from unit tests: • Unit tests are for developers and help you “build the thing right” • Acceptance tests are for customers and help you “build the right thing” • Acceptance tests are higher-level constructs that can be used to guide developers down the path of writing unit tests that will get them to their goal • Cucumber helps you write acceptance tests in the customer’s language • This encourages the customer to participate in a task they might otherwise skip From TDD to BDD
  • 14. Behaviour-driven development expands on test-driven development by: • Formalizing its best practices • In particular the perspective of working from the outside-in • Start work with failing customer acceptance tests • Write tests such that they serve as examples that anyone can read • Both to understand a requirement and to understand how to generate more requirements • Develop a process to encourage our customers to get involved with writing these requirements and to stay involved • Aim to develop a shared, ubiquitous language for talking about the system From TDD to BDD
  • 15. Make sure everyone (including your customers) speak about the system, its requirements and its implementation, in the same way: • “The case management system tracks the cases handled by service reps” • The whole team will now talk about “service reps” and “cases” • Any attempt to change that to, say, “workers” and “jobs” will be rejected • We want to see the same terms used to discuss the system to be present in the requirements, design documents, code, tests, etc. • Cucumber helps with this process since, as we shall see, it ties together the tests with the actual code of the system Ubiquitous Language
  • 16. Feature: Sign up Sign up should be quick and friendly Scenario: Successful sign up New users should get a confirmation e-mail and be greeted personally Given I have chosen to sign up When I sign up with valid details Then I should receive a confirmation email And I should see a personalized greeting message • Acceptance tests refer to features • Features are explained by scenarios • Scenarios consist of steps • The spec is written in natural language in a plain-text file • BUT the spec is executable! • Cucumber can guide us into turning the language of each step into an executable test case that calls our systems and can then either pass or fail • The way it does this is actually designed to get customers and developers working together Typical Cucumber Acceptance Test
  • 17. Cucumber is a command line tool that processes text files that contain features looking for scenarios that can be executed against your system It makes use of a bunch of conventions about how the files are named and where they live to make it easy to get started Each scenario is a list of steps that describe the pre-conditions, actions, and post-conditions of each scenario; if each step executes without error, the scenario is marked as having passed At the end of a run, Cucumber will report how many scenarios passed; if something fails, it provides information about what failed so the developer can make progress Features, scenarios, and steps are written in language called Gherkin How Cucumber Works
  • 18. To turn natural language into executable specifications: • Each step must be accompanied by a step definition • Most steps will gather input and then delegate to a framework that is specific to your application domain in order to make calls on your framework • For instance, TestCloud is a framework for automating interactions with Mobile devices • If your application is a mobile app, then your step definitions will most likely delegate to TestCloud to make sure that your application is loaded and then stepped through the scenario (“tap this button”, enter “Ben” in the “first name” field, etc.) • Your step definitions will likely be short and easy to maintain How Cucumber Works
  • 19. The key to Cucumber is the mapping between steps and step definitions. That’s “where the magic happens” and allows your non-technical customers to write specifications that will actually invoke and test the system that you are building! How Cucumber Works
  • 20. Gherkin is the language used to write features, scenarios, and steps The purpose of the language is to help us write concrete requirements Consider: - Customers should be prevented from entering invalid credit card details. Versus: - If a customer enters a credit card number that isn’t exactly 16 digits long, when they try to submit the form, it should be redisplayed with an error message advising them of the correct number of digits. The latter is much more testable; we want to remove as much ambiguity as possible in our requirements since ambiguity is a proven source of errors Gherkin is designed to create more concrete requirements Gherkin Language
  • 21. Feature: Feedback when entering invalid credit card details Background: (Applies to all Scenarios for that feature) Given I have chosen an item to buy And I am about to enter my credit card number Scenario: Credit card number too short (Scenario Definition) When I enter a card number that is less than 16 digits long And all the other details are correct And I submit the form Then the form should be redisplayed And I should see a message advising me of the correct number of digits Gherkin Format and Syntax
  • 22. The feature keyword is used to group a set of tests (scenarios) The text on the same line as the keyword is considered the name of the feature All text between the initial line and a line that starts with Scenario, Background, or Scenario Outline is considered part of a feature’s description Feature
  • 23. Think of your Users In order to identify features in your system, you can a “feature injection template”: In order to <meet some goal> As a <type of user> I want <a feature> The functional requirements of a system are determined by asking the Questions: • For each type of user • What goals are they trying to achieve? • What tasks must they perform to achieve those goals • How does our system support those tasks? Coming up with Features
  • 24. To express the behaviour of our system, we attach one or more scenarios with each feature It is typical to see 5 to 20 scenarios per feature to completely specify all the behaviours we’d like to see around a particular feature Scenarios follow a pattern: • Configure the system • Have it perform a specific action • Verify that the new state of the system is what we expected • We start with a context, describe an action, and check the outcome Scenario
  • 25. Gherkin provides three keywords to describe contexts, actions, and outcomes: • Given: establish context • When: perform action • Then: check outcome Example: Scenario: Withdraw money from account Given I have $100 in my account When I request $20 Then $20 should be dispensed Scenario
  • 26. You can add additional steps to the context, action, and outcome sections using the keywords ‘And’ and ‘But’ They allow you to specify scenarios in more detail Scenario: Attempt withdrawal using stolen card Given I have $100 in my account But my card is invalid When I request $50 Then my card should not be returned And I should be told to contact the bank These keywords help increase the expressiveness of the scenario Scenario
  • 27. In creating scenarios, a key design goal (indeed requirement) is that they must be stateless • “Each scenario must make sense and be able to be executed independently of any other scenario” • You can’t have the success condition of one scenario depend on the fact that some other scenario executed before it • Each scenario creates its particular context, executes one thing, and tests the result Scenario
  • 28. Having stateless scenarios provides multiple benefits: • Tests are simpler and easier to understand • You can run just a subset of your scenarios and you don’t have to worry about your test set breaking • Depending on your system, you might be able to run tests in parallel, reducing the amount of time it takes to execute all of your tests Scenario
  • 29. BDD Tools: SpecFlow, Cucumber, FitNesse, Nbehave, PHPUnit, Jbehave, Jasmine … Runners: Ruby, JRuby , .NET, JavaScript, - map cukes to application UI testing framework - Watir, Watin, Selenium, Capybara (headless), anything that supports WebDriver, TestCloud … Misc: Open source, strong community support Technology Stack
  • 30. As BDD features file get transformed into an existing unit testing framework executable, they play nice with any continuous integration solution such as: • TeamCity • Team Services • Jenkins • BitRise • … The executable generated will provide human readable feedback, such as: Step: ‘When I click on the login button’ failed with error ‘invalid username’ Automation
  • 31. BDD + Mobile BDD provides the only tests you need for your app, to achieve: - well designed app - well implemented - over-engineering free - high level test coverage - highly maintainable codebase
  • 32. BDD + Mobile Mobile device fragmentation issue: Impossible to predict how and app will behave on all the combinations of: • OS (iOS, Android, Windows phone) • OS Version (iOS 6,7,8,9 – Android jellybean, ice cream sandwich, nougat – Windows 8.1, UPW – Cyanogen Mod…) • Device screen factor (phones, phablets, tablets, eqach with their different sizes and dpi) • Device Specs (ram, cpu, sensors…) The app needs to be tested on each combinations to ensure it runs as expected
  • 33. BDD + Mobile UI Tests BDD Tests mimics the user interaction on devices in real time. All Mobile user interaction such as tap, slide, zoom, scroll, etc… are available Tests can be recorded with the help of a Test Recorder, that will ultimately generate the interaction code (following manually the BDD specifications) Or The BDD specifications are execute by the test runner as such, using libraries that binds steps keywords to test runner interaction pros: closest to the user truth cons: expensive (long time to run, cost)
  • 34. BDD + Mobile Acceptance Console Tests User interaction is abstracted to the commands it triggers on the underlying framework. For instance, on a MVVM environment, the tests definitions would: • Execute commands (that would execute when a user taps, scrolls, navigates…) • Assert the ViewModel properties (such as the text in the username and password fields) pros: cheap to run (fast execution) cons: no UI layer, therefore not as close from truth
  • 35. BDD + Mobile Best Approach: Write BDD specs once ( feature / scenarios / steps) Target both UITest and ACT runners Continuously run acceptance console tests (local / server on commit) Run ad hoc ui tests (locally) Run UI Tests Suite on dev complete (server on pre-merge)
  • 36. Thank You! Questions? ben@xamariners.com Ben Ishiyama-Levy Agile Technologist / .Net Pianist / Xamarin Evangelist / Driven Cucumberist www.xamariners.com www.meetup.com/SingaporeMobileDev