build the ‘right’ regression suite using behavior driven testing (bdt)

83
BUILD THE “RIGHT” REGRESSION SUITE USING BEHAVIOR DRIVEN TESTING (BDT) vodQA

Upload: thoughtworks

Post on 15-Jul-2015

2.696 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BUILD THE “RIGHT” REGRESSION SUITE USING BEHAVIOR DRIVEN TESTING (BDT) vodQA

Page 2: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

ABOUT US

about.me/anand.bagmar [email protected]

@BagmarAnand

[email protected]

Page 3: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

WHAT DO YOU EXPECT FROM THIS SESSION?

Page 4: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

CASE STUDY

•  Multiple, long running projects

•  Legacy applications

•  Integrated

Page 5: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Limited / flaky / long-running Automation

•  Long regression cycle

•  Huge cost of fixing defects

FUNCTIONAL TESTING CHALLENGES

Page 6: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Brittle

•  Little / less value

•  No visibility into what is tested

•  Maintenance nightmare

•  Outdated

•  Expensive

AS A RESULT

Page 7: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Trust deficit on the team •  In existing Automation

•  In manual testing

•  Finger pointing / blame game

BIGGEST PROBLEM

Page 8: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

My Case Study

Page 9: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 10: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Concept #1

Given -> When -> Then

Page 11: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Expected Functionality:

The customer should be able to withdraw money from his account via an ATM machine

Page 12: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDD Example:

Given the account has balance of 5000

When the customer requests 1000

Then the account is debited by 1000

Page 13: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

13

Page 14: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Workshop Begins – Iteration 1

Case Study

Page 15: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 16: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

PHASE 1 REQUIREMENTS

•  Guest User is able to search for a flight for a single traveller

•  Select option from Search Results page

•  Specify contact information for person booking the flight

Page 17: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

A Guest User can …

WORKFLOW

Search Search Results

Contact Information

Page 18: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

SEARCH MODULE

Page 19: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

SEARCH RESULTS

Page 20: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

CONTACT DETAILS

Page 21: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

CONTACT DETAILS

Page 22: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

PHASE 1 REQUIREMENTS

•  Guest User is able to search for a flight for a single traveller

•  Select option from Search Results page

•  Specify contact information for person booking the flight

Page 23: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

A Guest User can …

WORKFLOW

Search Search Results

Contact Information

Page 24: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

LETS GET STARTED … WRITE 2 TEST SCENARIOS

Page 25: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Iteration #1

Showcase

Page 26: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Concept #2

Test Specification Styles

Page 27: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Imperative

•  Declarative

TEST SPECIFICATION STYLES

Page 28: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

A Guest User can …

AN EXAMPLE

Search Search Results

Contact Information

Page 29: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

IMPERATIVE STYLE

Given I am a guest user on the home page

And I choose “round” trip option

And I select “Chicago” from the origin dropdown

And I select “San Francisco” from the destination dropdown

And I select departure date as “5 December 2013”

And I select returning date as “25 December 2013”

When I click on Search

Then I should see the search results page

And I should see at least 1 option for my criteria

...

Page 30: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

IMPERATIVE STYLE …

When I select the “first” option

Then I am on the Contact Information page

When I enter first name as “Anand”

And I enter last name as “Bagmar”

And I click the “Select and Continue” button

Then I should be on the next page

Page 31: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

DECLARATIVE STYLE

Given I am a guest user

When I search for flight options for a “one-way” trip for “1” “Adult” from “Chicago” to “San Francisco”

And I select the “first” flight

And I enter “valid” contact details for “traveller1”

Then I am able to Save and Continue

Page 32: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Ben Mabey - http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html

•  Alister Scott - http://watirmelon.com/2010/12/10/cucumber-imperative-or-declarative-that-is-the-question/

REFERENCES

Page 33: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Workshop – Iteration 2

Case Study Continues

Page 34: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  User registration from Contact information page

•  Registered user can login from home page (below search criteria)

•  For logged-in user, when booking ticket, contact information is pre-filled with logged-in user information

PHASE 2 REQUIREMENTS

Page 35: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Login Search Search Results

Contact Information

•  Pre-filled

WORKFLOW … ENHANCED

Page 36: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 37: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

REGISTERED USER

Page 38: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 39: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  User registration from Contact information page

•  Registered user can login from home page (below search criteria)

•  For logged-in user, when booking ticket, contact information is pre-filled with logged-in user information

PHASE 2 REQUIREMENTS

Page 40: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Login Search Search Results

Contact Information

•  Pre-filled

WORKFLOW … ENHANCED

Page 41: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

LETS GET STARTED … WRITE 2 TEST SCENARIOS

Page 42: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Iteration #2

Showcase

Page 43: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

WHY IS THIS IMPORTANT?

Page 44: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Concept #3

The Test Pyramid

Page 45: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

AUTOMATION – A SAFETY NET

Page 46: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  “Succeeding with Agile” – Mike Cohn

•  Martin Fowler – Test Pyramid

martinfowler.com/bliki/TestPyramid.html

THE TEST PYRAMID

Page 47: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Time Value Cost

IDEAL TEST AUTOMATION PYRAMID

Manual / Exploratory

UI

Web Service

View

JavaScript

Integration

Unit

Technology-facing Tests

Business-facing Tests

Page 48: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

REALITY

Page 49: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

UI

Web Service

View

JavaScript

Integration

Unit

Manual / Exploratory

ICE CREAM CONE ANTI PATTERN

Page 50: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Developers Test Pyramid QA Team Test Pyramid

Web Service

View

JavaScript

Integration

Unit

Manual / Exploratory

UI

Web Service

DUAL TEST PYRAMID ANTI-PATTERN

Page 51: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Concept #4

Behavior Driven Testing (BDT)

Page 52: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BEHAVIOR DRIVEN TESTING (BDT)

Page 53: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  How is this functionality going to be used by the end-user?

•  What is their thought process going to be when using this product?

•  What “core-business-value” should be delivered to the end-user?

THE BIG PICTURE

Page 54: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Manual / Exploratory

UI

Web Service

View

JavaScript

Integration

Unit

Technology-facing Tests

Business-facing Tests

Identify the “right” type of tests that sit on top of the Test Pyramid

Page 55: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

My Case Study

Page 56: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 57: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

HOW TO SOLVE THE PROBLEM?

Page 58: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Remove the ambiguity

•  Same visibility for all

SOLUTION

Page 59: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Whiteboards

•  Mind maps

•  Flow charts

•  Collaboration!!

TOOLS TO ENABLE BDT

Page 60: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

HOW DID WE ACCOMPLISH THIS?

Page 61: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

IDENTIFY BUSINESS FLOWS

Page 62: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Identify business flows based on personas, and how the personas use the business functionality, or,

•  Identify business flows, and how different user personas can use the business flows

NOTE: Business flows are different from UI flows

HOW TO IDENTIFY BUSINESS FLOWS ?

Page 63: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

PRIORITIZE BUSINESS FLOWS

Page 64: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

1st candidate •  Automate! •  High Value, Low Cost

2nd candidate •  Automate! •  High Value, High Cost

Can Automate? •  Manual Regression? •  Low Value, Low Cost

Do Not Automate •  Manual Regression! •  Low Value, High Cost

High Value

High Cost

Low Value

Low Cost

Page 65: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

AUTOMATE THE TOP LAYER USING

•  BDD Tools, or,

•  Directly in any appropriate programming language / tools

Page 66: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Identification of Tests

•  Automate it!

WHAT’S NEXT?

Page 67: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

AUTOMATE TESTS THAT ARE VALUABLE, NOT BECAUSE YOU CAN OR LIKE TO!

CAUTION!

Page 68: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Who is doing the action?

What is the business functionality?

Depicts a user flow / user journey

Actions & Verifications happen implicitly

Given auctioneer creates an auction And 5 vehicles are added to the auction When auctioneer starts the auction And auctioneer sets a starting bid of 5000 And buyer_1 bids And buyer_2 bids Then auctioneer Sells the vehicle And buyer_2 wins the vehicle

EXAMPLE

Page 69: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Delete profile

UPDATE BUSINESS FLOWS

Page 70: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

1st candidate •  Automate! •  High Value, Low Cost

2nd candidate •  Automate! •  High Value, High Cost

Can Automate? •  Manual Regression? •  Low Value, Low Cost

Do Not Automate •  Manual Regression! •  Low Value, High Cost

High Value

High Cost

Low Value

Low Cost

Page 71: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Project Management tool Mingle

Test case repository (manual + automated)

Cucumber .feature files with appropriate tagging

Feature files / Scenarios 33 / 65

# of Manual Tests 0

Tests running on CI (Jenkins) Since the 1st test was automated

Smoke tests execution time 15 minutes

Regression tests execution time

45 minutes

FINAL STATE … IN MY CASE STUDY

Page 72: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

•  Builds and deployments were automated

•  Tests ran on demand, automatically! •  Smoke / Regression / Javascript / Unit

•  Functional Performance

•  Concurrent Testing

ADDITIONALLY …

Page 73: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

How did this Technique (BDT) become successful?

Page 74: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

CONTEXT IS KING!

Domain

Distributed Teams

Skills

Capabilities Product-under test

Tech Stack

Process

Tools

Page 75: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

NOT work in isolation

BDT WILL …

Page 76: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDT REQUIRES …

Lower layers of Test Pyramid to be well automated!

Page 77: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDT REQUIRES …

Dedicated and Focused testing (manual / exploratory)

Page 78: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)
Page 79: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDT helps identify the “right” type of regression tests!

Page 80: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

Executable Specs

BDT Scenarios

Business Idea

Features

Epics

Stories

Iterations

Releases

BDT VALUE PROPOSITION

Page 81: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDT VALUE PROPOSITION …

Incrementally build

Business Flows

Regress Business Value

Test in-sync with Product Functionality

Effective Tests

Page 82: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

BDT VALUE PROPOSITION …

Remove ambiguity

Understand new functionality

Living Documentation

Onboarding

Page 83: Build the ‘Right’ Regression Suite using Behavior Driven Testing (BDT)

ABOUT US

about.me/anand.bagmar [email protected]

@BagmarAnand

[email protected]