Anand Bagmar - Behavior Driven Testing (BDT)

30
Behavior Driven Testing (BDT) Anand Bagmar Software Quality Evangelist ThoughtWorks

description

What is Behavior Driven Testing (BDT)? How does it differ from Behavior Driven Development? What tools support this kind of testing? The value proposition BDT offers. - Anand Bagmar

Transcript of Anand Bagmar - Behavior Driven Testing (BDT)

Page 1: Anand Bagmar - Behavior Driven Testing (BDT)

Behavior Driven Testing (BDT)

Anand Bagmar Software Quality Evangelist

ThoughtWorks

Page 2: Anand Bagmar - Behavior Driven Testing (BDT)

Case Study

• Multiple, long running projects

• Legacy applications

• Integrated

Page 3: Anand Bagmar - Behavior Driven Testing (BDT)

• No Automation - Long regression cycle

• Mini-Waterfall

• Huge cost of fixing defects

Testing Challenges

Page 4: Anand Bagmar - Behavior Driven Testing (BDT)

• No visibility into what is tested

• Outdated tests in QC

• Brittle

• Little / less value

• Maintenance nightmare

Page 5: Anand Bagmar - Behavior Driven Testing (BDT)
Page 6: Anand Bagmar - Behavior Driven Testing (BDT)
Page 7: Anand Bagmar - Behavior Driven Testing (BDT)

• Remove the ambiguity

• Same visibility for all roles on the team

Page 8: Anand Bagmar - Behavior Driven Testing (BDT)
Page 9: Anand Bagmar - Behavior Driven Testing (BDT)

Evolution of Test Frameworks

Behavior Driven

Development (BDD)

Optimized scripts

Record & Playback

Core Framework

Page 10: Anand Bagmar - Behavior Driven Testing (BDT)

Behavior Driven Development (BDD)

• Specify the behavior looking at the system from the outside.

• Collaborate and come up with a good and clear set of Acceptance Criteria

Page 11: Anand Bagmar - Behavior Driven Testing (BDT)

• BDD is an extension of TDD

– primarily a development practice

• Developers translate the Acceptance Criteria into product functionality

Behavior Driven Development (BDD)

Page 12: Anand Bagmar - Behavior Driven Testing (BDT)

Given the account has balance of INR 5000

When the customer requests INR 1000

Then the account is debited by INR 1000

Expected Functionality:

The customer should be able to withdraw money from his account

Page 13: Anand Bagmar - Behavior Driven Testing (BDT)

Behavior Driven Testing (BDT)

• It is an approach to testing

• Work towards the big picture

Page 14: Anand Bagmar - Behavior Driven Testing (BDT)

Given the account is in credit

And the dispenser contains cash

When the customer requests cash

Then ensure the account is debited

And ensure cash is dispensed

And ensure the card is returned

Page 15: Anand Bagmar - Behavior Driven Testing (BDT)

New Expected Functionality:

The customer should be able to withdraw money from his account only if his card is valid

Page 16: Anand Bagmar - Behavior Driven Testing (BDT)

Given the account is in credit

And the card is valid

And the dispenser contains cash

When the customer requests cash

Then ensure the account is debited

And ensure cash is dispensed

And ensure the card is returned

Page 19: Anand Bagmar - Behavior Driven Testing (BDT)

What does this do for me?

• Identify the different user flows / behaviors for the product

• Determine how the functionality under test affects / impacts the above user flows

• Incrementally build up your user flows

Page 20: Anand Bagmar - Behavior Driven Testing (BDT)

What does this do for me?

• Provide visibility

• Automate the right set of tests

• Make your testing efforts more effective

Page 21: Anand Bagmar - Behavior Driven Testing (BDT)
Page 22: Anand Bagmar - Behavior Driven Testing (BDT)
Page 23: Anand Bagmar - Behavior Driven Testing (BDT)

How did we accomplish this?

Page 24: Anand Bagmar - Behavior Driven Testing (BDT)
Page 25: Anand Bagmar - Behavior Driven Testing (BDT)

Who is doing the action?

What is the business functionality?

Actions and verifications / assertions happen implicitly

Long running tests

Page 26: Anand Bagmar - Behavior Driven Testing (BDT)

Current state

Testes running on Hudson / Jenkins Since 1st test was automated

Feature files 33

Scenarios 65

Smoke tests execution time 15 minutes

Regression tests execution time 45 minutes

Test case repository (manual + automated)

Cucumber .feature files with appropriate tagging

Project Management tool Mingle

Page 27: Anand Bagmar - Behavior Driven Testing (BDT)

Its not what I said, its what I

mean!

Page 28: Anand Bagmar - Behavior Driven Testing (BDT)

Are you doing BDD or BDT? Pattern Testing Type

The QA team does Test Automation along with other testing responsibilities.

BDT

The QA team focuses on defining acceptance criteria, doing manual / ad-hoc / exploratory testing, etc. and the development team itself will do Functional Test Automation.

BDD

The QA team focuses on defining acceptance criteria, doing manual / ad-hoc / exploratory testing, etc. and pairs with the development team to do Functional Test Automation.

BDD + BDT

Page 29: Anand Bagmar - Behavior Driven Testing (BDT)

Tools to enable BDD / BDT

• Cucumber

• JBehave

• SpecFlow

• Twist