92
BUILD THE “RIGHT” REGRESSION SUITE USING BEHAVIOR DRIVEN TESTING - BDT Anand Bagmar Test Practice Lead

Build the "right" regression suite using Behavior Driven Testing (BDT)

Embed Size (px)

Citation preview

Page 1: Build the "right" regression suite using Behavior Driven Testing (BDT)

BUILD THE “RIGHT” REGRESSION SUITE USING BEHAVIOR DRIVEN TESTING - BDT Anand Bagmar

Test Practice Lead

Page 2: Build the "right" regression suite using Behavior Driven Testing (BDT)

@BagmarAnand about.me/anand.bagmar

ABOUT ME

Page 3: Build the "right" regression suite using Behavior Driven Testing (BDT)

Think ….

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 – Iteration 1 Requirements

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 Evolved Requirements

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)

Test Automation

A PRACTICE THAT MAKES TEAMS SUCCESSFUL?

Page 46: Build the "right" regression suite using Behavior Driven Testing (BDT)

Test Automation

A PRACTICE THAT MAKES TEAMS UNSUCCESSFUL?

Page 47: Build the "right" regression suite using Behavior Driven Testing (BDT)

What is Test Automation?

Page 48: Build the "right" regression suite using Behavior Driven Testing (BDT)

Automation -

A Safety Net

Page 49: Build the "right" regression suite using Behavior Driven Testing (BDT)

Why do we do Test Automation?

Page 50: Build the "right" regression suite using Behavior Driven Testing (BDT)

QUICK FEEDBACK

Page 51: Build the "right" regression suite using Behavior Driven Testing (BDT)

How to get quick feedback from

Test Automation?

Page 52: 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 53: Build the "right" regression suite using Behavior Driven Testing (BDT)

IDEAL TEST AUTOMATION PYRAMID

Unit

Manual / Exploratory

Integration

JavaScript

View

Web Service

UI

Cost

Impact

Time

Business- facing Tests

Technology- facing Tests

Page 54: Build the "right" regression suite using Behavior Driven Testing (BDT)

REALITY

Page 55: Build the "right" regression suite using Behavior Driven Testing (BDT)

ICE-CREAM CONE ANTI PATTERN

Manual / Exploratory

UI

Web Service

View

JavaScript

Integration

Unit

Page 56: Build the "right" regression suite using Behavior Driven Testing (BDT)

Web Service

View

JavaScript

Integration

Unit

Developers Test Pyramid QA Team Test Pyramid

DUAL TEST PYRAMID ANTI-PATTERN

Manual / Exploratory

UI

Web Service

Page 57: Build the "right" regression suite using Behavior Driven Testing (BDT)

CUP-CAKE ANTI-PATTERN

Page 58: Build the "right" regression suite using Behavior Driven Testing (BDT)

Concept #4 Behavior Driven Testing

BDT

Page 59: Build the "right" regression suite using Behavior Driven Testing (BDT)

BEHAVIOR DRIVEN TESTING (BDT)

Page 60: 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 61: Build the "right" regression suite using Behavior Driven Testing (BDT)

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

Page 62: Build the "right" regression suite using Behavior Driven Testing (BDT)

My Case Study

Page 63: Build the "right" regression suite using Behavior Driven Testing (BDT)
Page 64: Build the "right" regression suite using Behavior Driven Testing (BDT)

HOW TO SOLVE THE PROBLEM?

Page 65: Build the "right" regression suite using Behavior Driven Testing (BDT)

•  Remove the ambiguity

•  Same visibility for all

SOLUTION

Page 66: Build the "right" regression suite using Behavior Driven Testing (BDT)

•  Whiteboards

•  Mind maps

•  Flow charts

•  Collaboration!!

TOOLS TO ENABLE BDT

Page 67: Build the "right" regression suite using Behavior Driven Testing (BDT)

HOW DID WE ACCOMPLISH THIS?

Page 68: Build the "right" regression suite using Behavior Driven Testing (BDT)

IDENTIFY BUSINESS FLOWS

Page 69: 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 70: Build the "right" regression suite using Behavior Driven Testing (BDT)

PRIORITIZE BUSINESS FLOWS

Page 71: 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 72: 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 73: Build the "right" regression suite using Behavior Driven Testing (BDT)

•  Identification of Tests

•  Automate it!

WHAT’S NEXT?

Page 74: Build the "right" regression suite using Behavior Driven Testing (BDT)

Caution!!

Page 75: Build the "right" regression suite using Behavior Driven Testing (BDT)

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

CAUTION!

Page 76: 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 77: Build the "right" regression suite using Behavior Driven Testing (BDT)

Delete profile

UPDATE BUSINESS FLOWS

Page 78: 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 79: 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 80: 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 81: Build the "right" regression suite using Behavior Driven Testing (BDT)

How did this technique (BDT) become

successful?

Page 82: 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 83: Build the "right" regression suite using Behavior Driven Testing (BDT)

BDT – Lessons Learnt

Page 84: Build the "right" regression suite using Behavior Driven Testing (BDT)

NOT work in isolation

BDT WILL …

Page 85: Build the "right" regression suite using Behavior Driven Testing (BDT)

BDT REQUIRES …

Lower layers of Test Pyramid to be well automated!

Page 86: Build the "right" regression suite using Behavior Driven Testing (BDT)

BDT REQUIRES …

Dedicated and Focused testing (manual / exploratory)

Page 87: Build the "right" regression suite using Behavior Driven Testing (BDT)
Page 88: Build the "right" regression suite using Behavior Driven Testing (BDT)

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

Page 89: 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 90: 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 91: Build the "right" regression suite using Behavior Driven Testing (BDT)

BDT VALUE PROPOSITION …

Remove ambiguity

Understand new functionality

Living Documentation

Onboarding

Page 92: Build the "right" regression suite using Behavior Driven Testing (BDT)

[email protected]

[email protected]

@BagmarAnand

about.me/anand.bagmar

THANK YOU