BDD in Automation Testing

Post on 15-Feb-2017

291 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

Transcript

www.axon.vnfb.com/AxonActiveVietNam

Who Am I?

My name Nguyen Thi Hong Thuy

Studied at Danang University of Technology

Master of Computer Science

IT developing experience started at University in 2004

Java Developer at MagRabbit VN

Java Developer, Tester at Axon Active VN

Email thuy.nguyen@axonactive.vn

www.axon.vnfb.com/AxonActiveVietNam

The Importance of Requirements Behavior Driven Developments (BDD)

• Why born BDD?• What is BDD?• Why use BDD?• BDD Style & Tools

How we have applied BDD in our projects Workshop Conclusion of BDD Q&A

Agenda

www.axon.vnfb.com/AxonActiveVietNam

The importance of requirements

www.axon.vnfb.com/AxonActiveVietNam

The importance of requirements

www.axon.vnfb.com/AxonActiveVietNam

The importance of requirements

www.axon.vnfb.com/AxonActiveVietNam

Behavior Driven Developments

www.axon.vnfb.com/AxonActiveVietNam

Test-driven development is a method of software development in which unit testing is repeatedly done on source code

TDD

Workflow of TDD

REFACTORGREEN

(Pass)

RED(Fail)

REPEAT PROCESS

1. Write a test that fails

2. Make only enough code for it to pass

3. Improve code quality

www.axon.vnfb.com/AxonActiveVietNam

Why born BDD?

www.axon.vnfb.com/AxonActiveVietNam

What is BDD?

Behavior-Driven Development (BDD) is a set of

software engineering practices designed to help

teams build and deliver more valuable, higher quality

software faster.

www.axon.vnfb.com/AxonActiveVietNam

BDD

Building the right software

Automated Acceptance Criteria

API and code design

Building the software right

Feature injection

Collaboration

Living Documentation

What is BDD?

www.axon.vnfb.com/AxonActiveVietNam

Workflow of TDD/BDD

BDD was originally designed as an improved version of TDD

TDD

BDD

Refactor

n cycles

Make the test pass

Write a failing test

Write a failing feature test

www.axon.vnfb.com/AxonActiveVietNam

Customer tells the business analyst what he wants

Why use BDD?

The business analyst writes a requirements document

The developer translates the requirements into software

The tester translates the requirements into test cases

Customer

The traditional development process

www.axon.vnfb.com/AxonActiveVietNam

There are many opportunities for information to get lost in

translation, be misunderstood, or just be ignored

Chances are that the new module itself may not do exactly what

was required and that the documentation won’t reflect the initial

requirements

Problems

www.axon.vnfb.com/AxonActiveVietNam

Why use BDD?

The development process is applying BDD

Customer and BA have a conversation about what he needs.

BA, the developer and the tester elaborate the requirements together

The automated tester The manual tester

The developer

Customer

www.axon.vnfb.com/AxonActiveVietNam

BDD Style – Feature file example

Meta:Narrative:In order to login ZingPoll successfullyAs a userI want to have single choice pollSo that I can create polls, share it to my friends & collect the option about it

Scenario: Create a single choice poll successfulGiven I am on ZingPoll websiteWhen I click the Sign In button on the menu bar to register an new accountThen The Sign In form should be shownWhen I enter email <email> and password <password>And I click the Sign In button on the formThen I log in into website successfulWhen I enter <question> into the question fieldAnd I enter the <first_anwser> and <second_answer> into the answer fieldsAnd I click the Create Poll buttonThen The poll is created successfully

Examples:|email |password |question |first_anwser|second_answer|bddteam1@gmail.com | zingpoll | Have you ever applied BDD in your project? |Yes |No|

Feature

Scenario

What business outcomes are you trying to achieve?

Who needs it ?

What must you do to help achieve this outcome?

Each row represents separate set of test data

www.axon.vnfb.com/AxonActiveVietNam

Feature: Login ZingPoll system

As a userI want to login to Zingpoll websiteSo that I can use all features

Who’s using the system? What are they doing?

Why do they care?

BDD Style – Feature file example

www.axon.vnfb.com/AxonActiveVietNam

Scenario: Login ZingPoll system successful

Given I am on ZingPoll website

When I click the Sign In button on the menu bar to register an new

account

Then The Sign In form should be shown

When I enter email <email> and password <password>

And I click the Sign In button on the form

Then I log in into website successful

• Given - Sets up preconditions, or context, for the scenario • When - The action, or behavior, that we’re focused on• Then - Checks post-conditions and verifies that the right thing happened in the When stage

BDD Style – Feature file example

www.axon.vnfb.com/AxonActiveVietNam

The principal activities and outcomes of BDD

Business goal Features Examples Executable specifications

Low-levelspecifications

Application codeLiving

documentation

Real-timeprogress reports

Technicaldocumentation

Automaticvalidation

www.axon.vnfb.com/AxonActiveVietNam

The principal activities and outcomes of BDD

Examples Executable specifications

Low-levelspecifications

Application code

www.axon.vnfb.com/AxonActiveVietNam

How we have applied BDD in our current projects

www.axon.vnfb.com/AxonActiveVietNam

Repositories

www.axon.vnfb.com/AxonActiveVietNam

Build Jenkins

www.axon.vnfb.com/AxonActiveVietNam

Pipeline

www.axon.vnfb.com/AxonActiveVietNam

Workshop

www.axon.vnfb.com/AxonActiveVietNam

Introduce ZingPoll Website

www.axon.vnfb.com/AxonActiveVietNam

The Business Rules layer

The Business Flow layer

The Technical layer

Well-written automated acceptance criteria

www.axon.vnfb.com/AxonActiveVietNam

Workshop

Story 1: As a ZingPoll userI want to login to ZingPoll websiteSo that I can use all features

www.axon.vnfb.com/AxonActiveVietNam

Workshop

Story 2: As a ZingPoll userI want to have single choice pollSo that I can create polls, share it to my friends & collect the option about it

www.axon.vnfb.com/AxonActiveVietNam

Conclusion of BDD

Focus effort

Reduce waste and misaligned requirement

Deliver more valuable software

Make changes safety

Faster and more reliable releases

Reduced maintenance costs

www.axon.vnfb.com/AxonActiveVietNam

Potential challenges of BDD

BDD requires high business engagement and collaboration

BDD works best in an Agile or iterative context

Poorly written tests can lead to higher test-maintenance costs

www.axon.vnfb.com/AxonActiveVietNam

Q&A

www.axon.vnfb.com/AxonActiveVietNam

Thanks for your attention

top related