40
Don’t you trust me? Seb Rose @sebrose www.claysnow.co.uk

Don't you trust me?

Embed Size (px)

DESCRIPTION

In many organisations there’s a tension between the desires of the three amigos: - business stakeholders can’t validate assumptions unless they’re written in business domain terms - testers would ideally test everything end to end (vertically) - developers respond that the testing pyramid encourages us to have more unit tests than integration or end-to-end tests It is often recommended that some tests that start off as scenarios get pushed ‘down’ into unit tests to keep the execution time under control and constrain the maintenance burden of the feature suite. The trouble with this is that even if the business folk and the testers trusted the developer’s unit tests implicitly (which they often don’t) there’s still the issue of visibility. We no longer have one complete, generally consumable, source living documentation. An approach that I have been experimenting with uses Cucumber’s tagged hooks to control the amount of application stack that a scenario exercises. This lets us tailor our execution context depending on the runtime of the feature suite and the amount of trust the team has to spare. In the limit, this allows us (where it makes sense) to expose some unit tests as scenarios – keeping our living documentation complete. The cost, of course, is added complexity.

Citation preview

Page 1: Don't you trust me?

Don’t you trust me?Seb Rose@sebrose

www.claysnow.co.uk

Page 2: Don't you trust me?

Business Driven Development

Page 3: Don't you trust me?

Beard Driven Development

Page 4: Don't you trust me?

Behaviour Driven Development

Page 6: Don't you trust me?

Easy transport of groceries

In order to get groceries home easily

Matt & Anna want

a way to transport them

Page 7: Don't you trust me?
Page 8: Don't you trust me?
Page 9: Don't you trust me?
Page 10: Don't you trust me?
Page 11: Don't you trust me?
Page 12: Don't you trust me?
Page 13: Don't you trust me?

Scenario: A month of groceries

Given I have opened the trunk When I load a month of groceries Then the suspension will cope

Page 14: Don't you trust me?

Scenario: A month of groceries

Given I have opened the trunk When I load a month of groceries Then the suspension will cope

Page 15: Don't you trust me?

Scenario: A year of groceries

Given I have opened the trunk When I load a year of groceries Then the suspension will cope

expected: "Within tolerance", got: "OVERLOADED"

Page 16: Don't you trust me?

Given I have opened the trunk

@Given(“^I have opened the trunk$”)public void i_have_opened_the_trunk() { myCar.openTrunk();}

Page 17: Don't you trust me?

So, what exactly IS the problem?

Page 18: Don't you trust me?
Page 19: Don't you trust me?
Page 20: Don't you trust me?
Page 21: Don't you trust me?
Page 22: Don't you trust me?
Page 23: Don't you trust me?
Page 24: Don't you trust me?
Page 25: Don't you trust me?
Page 26: Don't you trust me?

Feature: GPS usage Scenario: Start navigation to new destination Given I enter a new destination When I start navigation Then I should be given first direction

Page 27: Don't you trust me?

@Given("I enter a new destination")public void I_enter_a_new_destination() { // Do whatever it takes to enter new destination}

Page 28: Don't you trust me?

• What if there is no GPS signal?

• What if the destination provided is unknown?

• How will errors be communicated to the user?

Page 29: Don't you trust me?

Scenario: No GPS signal Given I enter a new destination And it there is no GPS signal When I start navigation Then I should see the correct error message

Scenario: Unknown destination Given I enter a new destination And the destination is unknown When I start navigation Then I should see the correct error message

Page 30: Don't you trust me?

Scenario Outline: Display correct error message When the navigation component returns an <error> Then the correct <message> should be returned Examples: | error | message | | no-gps-signal | "No GPS signal" | | unknown-destination | "Unknown destination" |

Page 31: Don't you trust me?

Scenario: No GPS signal Given I enter a new destination And it there is no GPS signal When I start navigation Then I should see the no-gps-signal message

Scenario: Unknown destination Given I enter a new destination And the destination is unknown When I start navigation Then I should see the unknown-destination message

Page 32: Don't you trust me?

Scenario: No GPS signal Given I enter a new destination And it there is no GPS signal When I start navigation Then I should see “No GPS signal”

Scenario: Unknown destination Given I enter a new destination And the destination is unknown When I start navigation Then I should see “Unknown destination”

Page 33: Don't you trust me?

@without_uiScenario: No GPS signal Given I enter a new destination And it there is no GPS signal When I start navigation Then I should see “No GPS signal”

Page 34: Don't you trust me?

private boolean without_ui = false;

@Before("@without_ui") public void beforeScenario() { without_ui = true; }

Page 35: Don't you trust me?

@Given("^I enter a new destination$") public void I_enter_a_new_destination() { if (without_ui){ // Call navigation component directly } else { // Drive UI directly using Selenium or similar. } }

Page 36: Don't you trust me?
Page 37: Don't you trust me?
Page 38: Don't you trust me?
Page 39: Don't you trust me?

•Exercise full application stack to build trust

•Reduce thickness as trust grows

•A few end-to-end scenarios is often all you need

•Keep living documentation comprehensive

Service manual

Page 40: Don't you trust me?

Seb  Rose

Twi$er:     @sebrose

Blog:       www.claysnow.co.uk

E-­‐mail:     [email protected]

Please evaluate my presentation at:www.touchmyconference.com/ATD2013

-JVM

Seb Rose,

Availa

ble 20

14

(hopef

ully)