SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
 
 
 
 
 

AT10
Concurrent Session 
11/8/2012 3:45 PM 
 
 
 
 
 
 
 

"Specification-by-Example:
A Cucumber Implementation"
 
 
 

Presented by:
Mary Thorn
Deutsche Bank
 
 
 
 
 
 
 
 

Brought to you by: 
 

 
 
340 Corporate Way, Suite 300, Orange Park, FL 32073 
888‐268‐8770 ∙ 904‐278‐0524 ∙ sqeinfo@sqe.com ∙ www.sqe.com
Mary Thorn
Deutsche Bank
VP of QA at Deutsche Bank Global Technologies in North Carolina, Mary Thorn has a
broad testing background that spans automation, data warehouses, and web-based
systems in a wide variety of technologies and testing techniques. During her more than
fifteen years of experience in healthcare, HR, and SaaS-based products, Mary has held
manager and contributor level positions in software development organizations. She
has a strong interest in agile testing methodologies and direct experience leading agile
teams through Scrum adoption and beyond. Mary is a Certified ScrumMaster and an
active participant in Triangle Institute of Software Quality Assurance.
.

 
Mary Thorn

QA Manager at Deutsche Bank.
Over 15 years of QA experience working in the following
areas: Healthcare HR Agriculture Financial and SaaS
Healthcare, HR, Agriculture,
SaaSbased products.
Have a broad testing background that spans
automation, data warehouses to web-based systems in
a wide variety of technologies and testing techniques.
Heavy interest in Agile Testing Methodologies and direct
experience leading Agile teams in the SCRUM Software
Development Lifecycle (SDLC).

1
•

Introduction

•

The Communication Problem

•

What are Acceptance Tests?

•

Simple Example

•

Acceptance Testing with Cucumber

•

Feature Files

•

Wrap up

Goal: Presenter would like to have a successful
presentation
Acceptance Criteria:
1. Verify the attendees stay awake
2. Verify the attendees are happy with the
presentation

2
The Challenge:
Today, the most difficult problem in software
development is knowing what to build, not how
to build it.
Knowing what to build, requires knowing why it
is being built. In other words, understanding the
goal.

The Problem:
Stories typically concentrate on the what and
the how, not the why. Goals and examples are
usually missing.
Stories are usually a list of imperative
requirements (acceptance criteria).
Imperative requirements are usually interpreted
in subtly different ways by each person. If goals
and examples are absent, misinterpretation is
much more likely.

3
Example:
Requirement: Draw a star with 10 points.

OR

Solution: Specification by Example
People understand requirements best using
concrete examples.
Examples clear up ambiguity and
misunderstandings.
Examples expose missing requirements.
Examples force everyone to think harder about
a problem.

4
Specification by Example
This is the basis of acceptance testing and
Behavior Driven Design (BDD).
It is critical that everyone participates in creating
the examples so that the understanding is
shared.
Ultimately, acceptance testing is less about the
example itself and more about the conversation
required to create the example.

What does this have
to do with automated
testing?

5
In a nutshell, automated
acceptance tests are
t
t t
executable examples that
define the system's
specifications
specifications.

Acceptance Tests are
Formal examples that define requirements
requirements.
Executable.
Self-explanatory and readable by all team
members.
Tests of business rules
rules.
A living specification of system behavior.

6
Acceptance Tests do NOT
Test pieces of code in isolation They are not a
isolation.
substitute for unit and integration tests.
Verify the entire system.
Verify all permutations of a piece of functionality.
Use mock objects except to remove a
dependency on an external 3rd party.

Benefits:
Higher quality b/c everyone shares the same
understanding of the requirements and builds it right the
first time.
Tests become the system's regression suite.
Create an objective verification of “done-ness” for a
story. A story is done when all tests pass.
Create transparency into p g
p
y
progress on a story.
y
Manual testers are part of the automation process.
Allows for more exploratory testing b/c happy path is
automated

7
Acceptance Criteria: Transactions are rounded
to the nearest cent.

Original Value

Rounded Value

$0.021

$0.02

$0.025
$0 025

$
$0.02

$0.029

$0.02

Why was there confusion?
The goal was missing...
Goal: Create a currency conversion system.
The Concrete Example clarified what was meant
by the acceptance criteria.
criteria
Refined Acceptance Criteria: Transactions are
always rounded down to the nearest cent.

8
This simple example is a REAL EXAMPLE in a
system that was well-tested and approved by all
y
pp
y
parties.
Attacker was able to steal > $15,000 starting
with a single cent using this process...
$0.01 → 0.0051 € rounded to 0.01 €
0.01 € → $0.0196 rounded to $0.02
A seemingly minor ambiguity in the
requirements was very expensive.

Concrete examples drive understanding and
consensus.
To create good representative examples,
everyone must understand the goal of the story.
For technical people to properly understand the
goal, they must understand the business
domain.
domain

9
What does
at
Cucumber have to
do with this?

• Cucumber lets software development teams
describe how software should behave in plain
text. The text is written in a business-readable
domain-specific language and serves as
documentation of requirements, automated
regression tests and development-aid - all
rolled into one format.
y,
,
,
• Cucumber works with Ruby, Java, .NET, Flex
or web applications written in any language. It
has been translated to over 40 spoken
languages.

10
Components:
•
•
•
•
•

Cucumber (Framework)
HTMLUnit (Browser Emulator)
Selinium/Watir (Browser Emulator API)
Features (Tests written in sentence format)
Step Definitions (Backend code to support
Features)

Command line –
Rake TAGS @abc

Cucumber
Framework - Tags

Terminal
Result Output-

Feature File Sentence

Browser Emulator

Step Definition File –
Matching Sentence

Selinium/Watir –
Execute Command

11
Process:
• Product Owner writes acceptance tests in
p
feature file scenarios format in the story. Worst
case, they at least start the Scenario:
• During grooming the team discusses the
scenarios and asks questions. Team can
add/remove scenarios during grooming or
team updates feature file after.
after
• Once Sprint has started QA and Dev work on
getting the feature file 90% complete before
the developer starts coding.

Process:
• The developers code the scenarios in the
feature file in a TDD manner.
• QA expands the scenarios in the feature files
after development if there are new findings.
• When testing is complete PO acceptance is
done by running the acceptance tests.

12
Two Components:
• The Feature files which contain the test
Scenarios.
• The Step Definition files which contain the Ruby
“glue” code that connects the tests to the
application.

Feature File Overview:
Written in plain text
Define the test suite and contain the actual tests
which are called Scenarios
Written collaboratively by everyone on the team
(PO, QA, and Dev)
QA can run these manually.

13
Feature:
Suite is defined by keyword “Feature:” followed
Feature:
by a description. This states the goal for the
Feature File. When the Feature File is
complete, a tag is included at this level so that
all of the test Scenarios contained within the file
can be run from a single command.
g
Feature: This tests the currency conversion
system

Background:
Background:
“Background:” is run before each test so that
you don’t have to repeat steps. Equal to a setup
step.
Background:
Given I login with the test account
And I navigate to the Transaction Screen
Then I should see the Transaction logo

14
Scenario:
Individual tests are defined by “Scenario:”
Scenario:
followed by a unique name. Scenarios are
concrete examples of how we want the software
to behave. The first line states the goal of the
given Scenario, while every line thereafter lists
the steps needed to complete the test.
p
p
Scenario: Verify Transactions are rounded
to the nearest cent.

Scenario Outline:
“Scenario Outline:” is used for data driven tests
Scenario Outline:
tests.
Scenario Outline: Verify Transactions are rounded to the nearest cent.
Given I am on the order screen
When I make a <transaction> of values
Then the <values> are rounded
Examples:
|transaction|values|
|t
ti | l
|
|.021|.02|
|.025|.02|
|.029|.02|

15
Keywords:
•

Tests have reserved words that begin each line:
Given, When, Then, And, But.
• Use Given to state a precondition
• Use When & And when taking an action
• Use Then when asserting a validation
Scenario Outline: Verify Transactions are rounded to the nearest cent.
Given I am on the order screen
When I make a transaction of 9.025
And save the transaction
Then the value should equal 9.02

Tags:
• Tags a powerful tool to organize tests and
scenarios. A Scenario or feature can have as
many tags as you like. Just separate them with
spaces.
• A note to the wise: Keep it simple.
@tag @smoke_test @component

16
@Cucumberpresentation
Feature: User would like to have a successful presentation
Tests the following acceptance criteria:
1. Verify the attendees are awake
2.
2 Verify the attendees are happy with the presentation
@Attendeeawake
Scenario: Verify the attendees are awake
Given that I am an attendee
When I have drunk caffeine
Then I will be able to listen to the presenter
@Attendeeishappy
Scenario: V if Att d
S
i Verify Attendees are happy
h
Given I am the presenter
When I talk slow
And my content is interesting
Then the attendees will be happy

Cucumber is a functional test automation tool for lean and
agile teams.
It supports behavior-driven development, specification by
p
g
p
g
example and agile acceptance testing.
You can use it to automate functional validation in a form that
is easily readable and understandable to business users,
developers and testers.
It helps teams create executable specifications, that are a
goal for development, acceptance criteria and functional
regression checks for future changes.
Allows teams to create living documentation, a single
authoritative source of information on system functionality
that is always up-to-date.
Allows manual testers to be involved in automation, as well
as, frees them up from testing the “happy path” to be able to
real exploratory testing.

17
QUESTIONS?

18

Contenu connexe

Tendances

Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
toteb5
 

Tendances (20)

Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Introduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven DevelopmentIntroduction to Acceptance Test Driven Development
Introduction to Acceptance Test Driven Development
 
Testing recipes
Testing recipesTesting recipes
Testing recipes
 
Approaching ATDD/BDD
Approaching ATDD/BDDApproaching ATDD/BDD
Approaching ATDD/BDD
 
Test driven-development
Test driven-developmentTest driven-development
Test driven-development
 
Leadership
LeadershipLeadership
Leadership
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
 
TDD That Was Easy!
TDD   That Was Easy!TDD   That Was Easy!
TDD That Was Easy!
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOS
 
BDD with JBehave
BDD with JBehaveBDD with JBehave
BDD with JBehave
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Acceptance tests
Acceptance testsAcceptance tests
Acceptance tests
 
The WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecThe WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpec
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
 

En vedette

En vedette (16)

Introducing Mobile Testing to Your Organization
Introducing Mobile Testing to Your OrganizationIntroducing Mobile Testing to Your Organization
Introducing Mobile Testing to Your Organization
 
Better Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous DeliveryBetter Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous Delivery
 
Planning Your Agile Testing: A Practical Guide
Planning Your Agile Testing: A Practical GuidePlanning Your Agile Testing: A Practical Guide
Planning Your Agile Testing: A Practical Guide
 
Pay Now or Pay More Every Day: Reduce Technical Debt Now!
Pay Now or Pay More Every Day: Reduce Technical Debt Now!Pay Now or Pay More Every Day: Reduce Technical Debt Now!
Pay Now or Pay More Every Day: Reduce Technical Debt Now!
 
Keynote: Lean Software Delivery: Synchronizing Cadence with Context
Keynote: Lean Software Delivery: Synchronizing Cadence with ContextKeynote: Lean Software Delivery: Synchronizing Cadence with Context
Keynote: Lean Software Delivery: Synchronizing Cadence with Context
 
Exploratory Testing Is Now in Session
Exploratory Testing Is Now in SessionExploratory Testing Is Now in Session
Exploratory Testing Is Now in Session
 
Tune Agile Test Strategies to Project and Product Maturity
Tune Agile Test Strategies to Project and Product MaturityTune Agile Test Strategies to Project and Product Maturity
Tune Agile Test Strategies to Project and Product Maturity
 
Innovations in Test Automation: It’s Not All about Regression
Innovations in Test Automation: It’s Not All about RegressionInnovations in Test Automation: It’s Not All about Regression
Innovations in Test Automation: It’s Not All about Regression
 
It Seemed a Good Idea at the Time: Intelligent Mistakes in Test Automation
It Seemed a Good Idea at the Time: Intelligent Mistakes in Test AutomationIt Seemed a Good Idea at the Time: Intelligent Mistakes in Test Automation
It Seemed a Good Idea at the Time: Intelligent Mistakes in Test Automation
 
Testing—After You’ve Finished Testing
Testing—After You’ve Finished TestingTesting—After You’ve Finished Testing
Testing—After You’ve Finished Testing
 
Maybe We Don’t Have to Test It
Maybe We Don’t Have to Test ItMaybe We Don’t Have to Test It
Maybe We Don’t Have to Test It
 
Build Your Own Performance Test Lab in the Cloud
Build Your Own Performance Test Lab in the CloudBuild Your Own Performance Test Lab in the Cloud
Build Your Own Performance Test Lab in the Cloud
 
New Testing Standards Are on the Horizon: What Will Be Their Impact?
New Testing Standards Are on the Horizon: What Will Be Their Impact?New Testing Standards Are on the Horizon: What Will Be Their Impact?
New Testing Standards Are on the Horizon: What Will Be Their Impact?
 
How Spotify Tests World Class Apps
How Spotify Tests World Class AppsHow Spotify Tests World Class Apps
How Spotify Tests World Class Apps
 
Keynote: Lightning Strikes the Keynotes
Keynote: Lightning Strikes the KeynotesKeynote: Lightning Strikes the Keynotes
Keynote: Lightning Strikes the Keynotes
 
Exploratory Testing Explained
Exploratory Testing ExplainedExploratory Testing Explained
Exploratory Testing Explained
 

Similaire à Specification-by-Example: A Cucumber Implementation

CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIESCHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
Samruddhi Sheth
 
Manual Testing real time questions .pdf
Manual Testing real time questions .pdfManual Testing real time questions .pdf
Manual Testing real time questions .pdf
TiktokIndia2
 

Similaire à Specification-by-Example: A Cucumber Implementation (20)

Implement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlowImplement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlow
 
Agile testing
Agile testingAgile testing
Agile testing
 
Effective Testing Practices in an Agile Environment
Effective Testing Practices in an Agile EnvironmentEffective Testing Practices in an Agile Environment
Effective Testing Practices in an Agile Environment
 
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh EastmanBehavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
 
Quality Jam: BDD, TDD and ATDD for the Enterprise
Quality Jam: BDD, TDD and ATDD for the EnterpriseQuality Jam: BDD, TDD and ATDD for the Enterprise
Quality Jam: BDD, TDD and ATDD for the Enterprise
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibile
 
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
 
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 run an Enterprise PHP Shop
How to run an Enterprise PHP ShopHow to run an Enterprise PHP Shop
How to run an Enterprise PHP Shop
 
Resume 2 year
Resume  2 yearResume  2 year
Resume 2 year
 
CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIESCHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
CHAPTER 1 BASIC CONCEPTS AND PRELIMINARIES
 
Agile Testing and Test Automation
Agile Testing and Test AutomationAgile Testing and Test Automation
Agile Testing and Test Automation
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
! Testing for agile teams
! Testing for agile teams! Testing for agile teams
! Testing for agile teams
 
Quality Assurance and Testing services
Quality Assurance and Testing servicesQuality Assurance and Testing services
Quality Assurance and Testing services
 
Manual Testing real time questions .pdf
Manual Testing real time questions .pdfManual Testing real time questions .pdf
Manual Testing real time questions .pdf
 
'BIG Testing' with Hans Buwalda
'BIG Testing' with Hans Buwalda 'BIG Testing' with Hans Buwalda
'BIG Testing' with Hans Buwalda
 
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
 
Ben Walters - Creating Customer Value With Agile Testing - EuroSTAR 2011
Ben Walters - Creating Customer Value With Agile Testing - EuroSTAR 2011Ben Walters - Creating Customer Value With Agile Testing - EuroSTAR 2011
Ben Walters - Creating Customer Value With Agile Testing - EuroSTAR 2011
 

Plus de TechWell

Plus de TechWell (20)

Failing and Recovering
Failing and RecoveringFailing and Recovering
Failing and Recovering
 
Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization
 
Test Design for Fully Automated Build Architecture
Test Design for Fully Automated Build ArchitectureTest Design for Fully Automated Build Architecture
Test Design for Fully Automated Build Architecture
 
System-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good StartSystem-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good Start
 
Build Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test StrategyBuild Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test Strategy
 
Testing Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for SuccessTesting Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for Success
 
Develop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your SanityDevelop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your Sanity
 
Ma 15
Ma 15Ma 15
Ma 15
 
Eliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps StrategyEliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps Strategy
 
Transform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOpsTransform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOps
 
The Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—LeadershipThe Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—Leadership
 
Resolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile TeamsResolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile Teams
 
Pin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile GamePin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile Game
 
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile TeamsAgile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
 
A Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps ImplementationA Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps Implementation
 
Databases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery ProcessDatabases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery Process
 
Mobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to AutomateMobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to Automate
 
Cultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for SuccessCultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for Success
 
Turn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile TransformationTurn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile Transformation
 
Scale: The Most Hyped Term in Agile Development Today
Scale: The Most Hyped Term in Agile Development TodayScale: The Most Hyped Term in Agile Development Today
Scale: The Most Hyped Term in Agile Development Today
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Specification-by-Example: A Cucumber Implementation

  • 1.           AT10 Concurrent Session  11/8/2012 3:45 PM                "Specification-by-Example: A Cucumber Implementation"       Presented by: Mary Thorn Deutsche Bank                 Brought to you by:        340 Corporate Way, Suite 300, Orange Park, FL 32073  888‐268‐8770 ∙ 904‐278‐0524 ∙ sqeinfo@sqe.com ∙ www.sqe.com
  • 2. Mary Thorn Deutsche Bank VP of QA at Deutsche Bank Global Technologies in North Carolina, Mary Thorn has a broad testing background that spans automation, data warehouses, and web-based systems in a wide variety of technologies and testing techniques. During her more than fifteen years of experience in healthcare, HR, and SaaS-based products, Mary has held manager and contributor level positions in software development organizations. She has a strong interest in agile testing methodologies and direct experience leading agile teams through Scrum adoption and beyond. Mary is a Certified ScrumMaster and an active participant in Triangle Institute of Software Quality Assurance. .  
  • 3. Mary Thorn QA Manager at Deutsche Bank. Over 15 years of QA experience working in the following areas: Healthcare HR Agriculture Financial and SaaS Healthcare, HR, Agriculture, SaaSbased products. Have a broad testing background that spans automation, data warehouses to web-based systems in a wide variety of technologies and testing techniques. Heavy interest in Agile Testing Methodologies and direct experience leading Agile teams in the SCRUM Software Development Lifecycle (SDLC). 1
  • 4. • Introduction • The Communication Problem • What are Acceptance Tests? • Simple Example • Acceptance Testing with Cucumber • Feature Files • Wrap up Goal: Presenter would like to have a successful presentation Acceptance Criteria: 1. Verify the attendees stay awake 2. Verify the attendees are happy with the presentation 2
  • 5. The Challenge: Today, the most difficult problem in software development is knowing what to build, not how to build it. Knowing what to build, requires knowing why it is being built. In other words, understanding the goal. The Problem: Stories typically concentrate on the what and the how, not the why. Goals and examples are usually missing. Stories are usually a list of imperative requirements (acceptance criteria). Imperative requirements are usually interpreted in subtly different ways by each person. If goals and examples are absent, misinterpretation is much more likely. 3
  • 6. Example: Requirement: Draw a star with 10 points. OR Solution: Specification by Example People understand requirements best using concrete examples. Examples clear up ambiguity and misunderstandings. Examples expose missing requirements. Examples force everyone to think harder about a problem. 4
  • 7. Specification by Example This is the basis of acceptance testing and Behavior Driven Design (BDD). It is critical that everyone participates in creating the examples so that the understanding is shared. Ultimately, acceptance testing is less about the example itself and more about the conversation required to create the example. What does this have to do with automated testing? 5
  • 8. In a nutshell, automated acceptance tests are t t t executable examples that define the system's specifications specifications. Acceptance Tests are Formal examples that define requirements requirements. Executable. Self-explanatory and readable by all team members. Tests of business rules rules. A living specification of system behavior. 6
  • 9. Acceptance Tests do NOT Test pieces of code in isolation They are not a isolation. substitute for unit and integration tests. Verify the entire system. Verify all permutations of a piece of functionality. Use mock objects except to remove a dependency on an external 3rd party. Benefits: Higher quality b/c everyone shares the same understanding of the requirements and builds it right the first time. Tests become the system's regression suite. Create an objective verification of “done-ness” for a story. A story is done when all tests pass. Create transparency into p g p y progress on a story. y Manual testers are part of the automation process. Allows for more exploratory testing b/c happy path is automated 7
  • 10. Acceptance Criteria: Transactions are rounded to the nearest cent. Original Value Rounded Value $0.021 $0.02 $0.025 $0 025 $ $0.02 $0.029 $0.02 Why was there confusion? The goal was missing... Goal: Create a currency conversion system. The Concrete Example clarified what was meant by the acceptance criteria. criteria Refined Acceptance Criteria: Transactions are always rounded down to the nearest cent. 8
  • 11. This simple example is a REAL EXAMPLE in a system that was well-tested and approved by all y pp y parties. Attacker was able to steal > $15,000 starting with a single cent using this process... $0.01 → 0.0051 € rounded to 0.01 € 0.01 € → $0.0196 rounded to $0.02 A seemingly minor ambiguity in the requirements was very expensive. Concrete examples drive understanding and consensus. To create good representative examples, everyone must understand the goal of the story. For technical people to properly understand the goal, they must understand the business domain. domain 9
  • 12. What does at Cucumber have to do with this? • Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain-specific language and serves as documentation of requirements, automated regression tests and development-aid - all rolled into one format. y, , , • Cucumber works with Ruby, Java, .NET, Flex or web applications written in any language. It has been translated to over 40 spoken languages. 10
  • 13. Components: • • • • • Cucumber (Framework) HTMLUnit (Browser Emulator) Selinium/Watir (Browser Emulator API) Features (Tests written in sentence format) Step Definitions (Backend code to support Features) Command line – Rake TAGS @abc Cucumber Framework - Tags Terminal Result Output- Feature File Sentence Browser Emulator Step Definition File – Matching Sentence Selinium/Watir – Execute Command 11
  • 14. Process: • Product Owner writes acceptance tests in p feature file scenarios format in the story. Worst case, they at least start the Scenario: • During grooming the team discusses the scenarios and asks questions. Team can add/remove scenarios during grooming or team updates feature file after. after • Once Sprint has started QA and Dev work on getting the feature file 90% complete before the developer starts coding. Process: • The developers code the scenarios in the feature file in a TDD manner. • QA expands the scenarios in the feature files after development if there are new findings. • When testing is complete PO acceptance is done by running the acceptance tests. 12
  • 15. Two Components: • The Feature files which contain the test Scenarios. • The Step Definition files which contain the Ruby “glue” code that connects the tests to the application. Feature File Overview: Written in plain text Define the test suite and contain the actual tests which are called Scenarios Written collaboratively by everyone on the team (PO, QA, and Dev) QA can run these manually. 13
  • 16. Feature: Suite is defined by keyword “Feature:” followed Feature: by a description. This states the goal for the Feature File. When the Feature File is complete, a tag is included at this level so that all of the test Scenarios contained within the file can be run from a single command. g Feature: This tests the currency conversion system Background: Background: “Background:” is run before each test so that you don’t have to repeat steps. Equal to a setup step. Background: Given I login with the test account And I navigate to the Transaction Screen Then I should see the Transaction logo 14
  • 17. Scenario: Individual tests are defined by “Scenario:” Scenario: followed by a unique name. Scenarios are concrete examples of how we want the software to behave. The first line states the goal of the given Scenario, while every line thereafter lists the steps needed to complete the test. p p Scenario: Verify Transactions are rounded to the nearest cent. Scenario Outline: “Scenario Outline:” is used for data driven tests Scenario Outline: tests. Scenario Outline: Verify Transactions are rounded to the nearest cent. Given I am on the order screen When I make a <transaction> of values Then the <values> are rounded Examples: |transaction|values| |t ti | l | |.021|.02| |.025|.02| |.029|.02| 15
  • 18. Keywords: • Tests have reserved words that begin each line: Given, When, Then, And, But. • Use Given to state a precondition • Use When & And when taking an action • Use Then when asserting a validation Scenario Outline: Verify Transactions are rounded to the nearest cent. Given I am on the order screen When I make a transaction of 9.025 And save the transaction Then the value should equal 9.02 Tags: • Tags a powerful tool to organize tests and scenarios. A Scenario or feature can have as many tags as you like. Just separate them with spaces. • A note to the wise: Keep it simple. @tag @smoke_test @component 16
  • 19. @Cucumberpresentation Feature: User would like to have a successful presentation Tests the following acceptance criteria: 1. Verify the attendees are awake 2. 2 Verify the attendees are happy with the presentation @Attendeeawake Scenario: Verify the attendees are awake Given that I am an attendee When I have drunk caffeine Then I will be able to listen to the presenter @Attendeeishappy Scenario: V if Att d S i Verify Attendees are happy h Given I am the presenter When I talk slow And my content is interesting Then the attendees will be happy Cucumber is a functional test automation tool for lean and agile teams. It supports behavior-driven development, specification by p g p g example and agile acceptance testing. You can use it to automate functional validation in a form that is easily readable and understandable to business users, developers and testers. It helps teams create executable specifications, that are a goal for development, acceptance criteria and functional regression checks for future changes. Allows teams to create living documentation, a single authoritative source of information on system functionality that is always up-to-date. Allows manual testers to be involved in automation, as well as, frees them up from testing the “happy path” to be able to real exploratory testing. 17