Top Banner
Gauge your BDD Tests vodQA Hyderabad 2015 Shivaling Apoorva M Mahendra Kariya
22

BDD with Gauge

Apr 09, 2017

Download

Software

vodQA
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: BDD with Gauge

Gauge your BDD Tests

vodQA Hyderabad 2015

Shivaling

Apoorva M

Mahendra Kariya

Page 2: BDD with Gauge

Agenda

● Discussion about BDD (15 mins)

● Hands-on workshop (75 mins)

● Advanced Features Demo (15 mins)

● Q & A (15 mins)

Page 3: BDD with Gauge

#vodqa

#thoughtworks

@getgauge

Page 4: BDD with Gauge

What is TDD?

Test-driven development (TDD) is a technique for

building software that guides software development by

writing tests first.

- Martin Fowler

Page 5: BDD with Gauge

TDD (Contd…)

● Req: Calculation engine to be able to add 2 numbers

● Tests

○ @Test

shouldAddPositiveNumbers() {

assertEquals(calculator.add(1, 2), 3);

}

○ @Test

shouldAddNegativeNumbers() {

assertEquals(calculator.add(-1, -2), -3);

}

○ @Test

shouldAddNumbersInWords(){

assertEquals(calculator.add(“one”, “two”), 3);

}

Page 6: BDD with Gauge

So, BDD then?

People are moving towards BDD

But what is BDD?

Page 7: BDD with Gauge

When asked what is BDD

● It’s just TDD right?

● That Given-When-Then thing

● Business driven development

● The BA/PO writes the requirements and then the devs

write tests

Page 8: BDD with Gauge

A collaborative way to define what behaviour in a system

should be tested, by using the same language (natural

language) and grammar used to capture the business need.

BDD is...

Page 9: BDD with Gauge

The Requirement

As a [Role]

I want [Feature]

So that I receive [Value]

As an online shopper

I want to search for products

So that I can make buying decision

Page 10: BDD with Gauge

The Test

Given [Context]

When [Event Occurs]

Then [Outcome]

Given that I have logged in

When I search for a product

Then list of related items are displayed

Page 11: BDD with Gauge

A Badly Written Test

Given that I am on the home page

When I click on the “login” link

And I type text “Mahendra” in the “name” text box

And I type “pwd” in the “password” text box

And I click the “login” button

Then I can see my profile

Page 12: BDD with Gauge

A Well Written Test

Given I land on the homepage

When I log into my account with username “Mahendra” and

password “pwd”

Then I am on the “profile” page

Page 13: BDD with Gauge

Another Well Written Test

● Open Home Page

● Login with with username “Mahendra” and password

“pwd”

● “Profile” page is displayed

Page 14: BDD with Gauge

Popular BDD testing frameworks

● Cucumber (https://cucumber.io)

● Jasmine (http://jasmine.github.io)

● JBehave (http://jbehave.org)

● Concordian (http://concordion.org)

● easyb (http://easyb.org)

Page 15: BDD with Gauge

In a tool we want...

● Simplicitybecause who doesn’t like simple!!

● Maintainabilitybecause everyone has been on a long running project and we know it is hell to keep tests working

● Customisabilitybecause we all have our own preferences

● Speedbecause we all have that need for speed

Page 16: BDD with Gauge

What if we want to break away from every form of syntax and write specifications in natural

language?

Like you’d write an email

Page 17: BDD with Gauge

http://getgauge.io

Page 18: BDD with Gauge

About Gauge

● Open Source

● Simple Markdown syntax

● Multiple Language Support (Java, C#, Ruby)

● First class parallel execution support

● Extensible and Hackable

● IDE support (IntelliJ, VS, Eclipse)

● First class CI / CD integration support

Page 19: BDD with Gauge

Hands - on Workshop

Page 20: BDD with Gauge

Advanced Features Demo

● Table driven execution

● Data Store

● Tags & tag expressions

● Execution hooks

● Parallel Execution

● Concepts

Page 22: BDD with Gauge

THANK YOUFor questions or suggestions:[email protected]

[email protected]

@getgauge

http://getgauge.io