succeeding with behavior driven development bdd testing and automation n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Succeeding with Behavior Driven Development (BDD) Testing and Automation PowerPoint Presentation
Download Presentation
Succeeding with Behavior Driven Development (BDD) Testing and Automation

Loading in 2 Seconds...

play fullscreen
1 / 27

Succeeding with Behavior Driven Development (BDD) Testing and Automation - PowerPoint PPT Presentation


  • 119 Views
  • Uploaded on

Succeeding with Behavior Driven Development (BDD) Testing and Automation. Seattle Area Software Quality Assurance Group Oct 18, 2012 Alan Myrvold Google. Google Test Engineer, Ads Microsoft SDET in Office Security + Outlook Entrust Test manager, development manager,

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Succeeding with Behavior Driven Development (BDD) Testing and Automation' - yetty


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
succeeding with behavior driven development bdd testing and automation

Succeeding with Behavior Driven Development (BDD) Testing and Automation

Seattle Area Software Quality Assurance Group

Oct 18, 2012

Alan Myrvold

Google

about me
Google

Test Engineer, Ads

Microsoft

SDET in Office Security + Outlook

Entrust

Test manager, development manager,

security assurance manager

Cognos

Tester, developer, test manager,

development manager

About me

Feb 2011 - now

2005 - 2011

1998 - 2005

1988 - 1998

buzzword bingo
Buzzword bingo

ATDD

BDD

Cucumber

Cucumber - JVM

Gherkin

Jasmine

SpecFlow

buzzword bingo1
Buzzword bingo

ATDD- acceptance test driven development

BDD- behavior driven development

Cucumber- a Ruby tool that supports BDD

Cucumber - JVM - a Java tool that supports BDD

Gherkin - the language used by Cucumber

Jasmine - a javascript tool for BDD

SpecFlow - a .NET tool for BDD

slide6

Cucumber Example

Feature:Addition

In order to avoid silly mistakes

As amath idiot

I wantto be told the sum of two numbers

Scenario: Add two numbers

Given I have entered 50 into the calculator

And I have entered 70 into the calculator

When I press add

Then the result should be 120 on the screen

slide9

Scenario Outline Example

Scenario Outline: Add two numbers

Given I have entered <x>into the calculator

AndI have entered <y>into the calculator

When I press add

Thenthe result should be <z>on the screenExamples:| x | y | z || 2 | 3 | 5 || 0 | -1 | -1 |

why bdd
Why BDD?

Clarifying requirements by example

Demystifying automated tests by using English

Demystifying repeated manual tests by emphasizing why and what to verify.

how i used bdd at microsoft
How I used BDD at Microsoft

Clarifying requirements in my test plan.

how we are using bdd at google
How we are using BDD at Google

My group, DoubleClick Bid Manager, uses BDD for Java API-level system tests and repeated manual tests.

Other groups use BDD tests for Java WebDriver tests.

We share the same framework, developed internally.

tools support books
Tools support + Books

Tools:

  • Cucumber - Ruby http://cukes.info
  • Cucumber JVM https://github.com/cucumber/cucumber-jvm
  • SpecFlow - Binding business requirements to .NET codehttp://specflow.org

Books

  • The Cucumber Book
  • The RSpec Book
  • Cucumber Recipies (beta, scheduled 3/7/2013)

All books from Pragmatic Programmers, http://pragprog.com

when then elsewhere
When / Then elsewhere

Mockito … a Java unit testing framework

@Mock CalculationEngine engine;

Calculator calculator = new Calculator(engine);

when(engine.add(2, 2)).thenReturn(4);

calculator.parse("2 + 2 =");

assertEquals("4", caclulator.getResult());

Compare the syntax to EasyMock:

expect(engine.add(2, 2)).andReturn(4);

d escribe it
describe / it

Rspec … a Ruby unit testing framework

describe Calculator, "#basics"do

it "return 4 for 2+2"do

calc = Caculator.new

calc.add(2, 2)

calc.result.shouldeq(4)

end

end

Jasmine … a Javascript unit testing framework

describe("calc", function() {

it("2+2 is 4", function() {

expect(calc(2, 2).toEqual(4);

});

});

failure mode 1 too implementation dependent
BETTER

When I add 50 and 70

Then the result is 120

Failure mode #1 - Too implementation dependent

BAD

Given I have entered 50 into the calculator

And I have entered 70 into the calculator

When I press add

Then the result should be 120 on the screen

failure mode 2 programmatic scripts
BETTER

Then set the first 50 rows to "empty"

Failure mode #2 - Programmatic Scripts

BAD

When I set x to 1

And while x < 50

And set row x to "empty"

failure mode 3 too low level
BETTER

When I log in as "bob"

Failure mode #3 - Too low level

BAD

When I go to the login page

And enter "bob" into the username field

And enter "pass123" into the password field

And click login

Then I am logged in as "bob"

failure mode 4 not exploring interesting cases
BETTER

When I add 50 and 70

Then the result is 120

When I add 1e90, 0.1, and -1e90

Then the result is 0.1

Failure mode #4 - Not exploring interesting cases

BAD

When I add 50 and 70

Then the result is 120

failure mode 5 not using regex
BETTER

@When("Set the budget to (.*)")

public void setBudget(int amount)

{

...

}

Failure mode #5 - Not using regex

BAD

@When("Set the budget to 100")

public void setBudget()

{

...

}

failure mode 6 complex parsing logic
BETTER

@When("Set the budget to (.*)")

public void setBudget(int amount)

{

...

}

Failure mode #6 - Complex parsing logic

BAD

@When("(.*) the (.*) to (.*)")

public void doAction(String action, String name, String value)

{

if (action.equals("set") && name.equals("budget")

}

failure mode 7 leaking code details
BETTER

When I refresh all

Failure mode #7 - Leaking code details

BAD

When I click the BTN-REFRESH-ALL button

failure mode 8 bad test architecture
BETTER

Using supported public or test API's

Failure mode #8 - Bad test architecture

BAD

Calling entry points in code that are fragile, or disappear

success tips from me
Success tips from me

Use BDD for a small set of tests

Focus on human readability, as a domain expert using the feature would describe a test

success tips from the cucumber book by matt wayne and aslak hellesoy
Success tips from The Cucumber Book, by Matt Wayne and Aslak Hellesoy

DAMP beats DRY

DAMP: Descriptive and meaningful phrases

DRY: Don’t repeat yourself

Declarative better than imperative

Declarative: Given I am logged in

Imperative: Log in as user “Bob”