45
Acceptance Test Driven Development Michael Eselgroth Daryn Holmes

Acceptance Test Driven Development Michael Eselgroth Daryn Holmes

Embed Size (px)

Citation preview

Acceptance Test Driven Development

Michael EselgrothDaryn Holmes

Story Mapping

Story Mapping Demo

User Stories

As a …

I want …

So that …

Who?

What?

Why?

Who, what, why but not how…

Requirements

• Stories are reminders for a future discussion • Drive out the requirements, in the form of examples• Specification by example• Preferably in a format that can be automatically executed

and verified

• Tools often use the following advertising: • “Business users can now write their own

requirements in their own language”

StoryHigh level requirement

May contain high level acceptance criteria

Specification by ExampleLow level requirements

Specific examples\scenarios of acceptance criteria

Example 1 Example 2 Example n

CodeIncludes unit testing and fleshing out the

scenarios\examples into complete automated acceptance tests

ATDD (BDD)

Anatomy of ATDD

• System Under Test (SUT)• BDD Framework

– Runs examples\scenarios– Cucumber, Fitnsesse

• SUT Driver– Execute and drive the SUT– White, Selenium WebDriver

• Verification Framework– Built into Fitnesse– Unit Test verification– JUnit, Nunit, RSpec

FIT, Cucumber etc

Demo

Intelligent Testing

• No strict rules for all situations• Unit testing• Feature testing• Sensible slices• Somewhere in between

Smart Home

SUT

Smart Home Controller

Smart Home

Transmitter

Message Adapter

Business logic, database etc

Smart Home

‘Test’ Message Transmitter

Message Adaptor

Business logic, database etc

Smart Home

‘Test’ Message Transmitter

Message Adapter

Business logic, database etc

Smart Home

‘Test’ Message Transmitter

Message Adapter

Business logic, database etc

Smart Home

‘Test’ Message Transmitter

Message Adapter

Business logic, database etc

Message Adapter

Test Harness

Not Requested

Example: Automated Data Input

DatabaseBackground Application

(scheduled task)

Feed Provider

Content Team

Raw DataCalculated Data

Email

End To End Integration Test

DatabaseRepository WebHandler

EmailNotifier

Domain

Mocked

Mocked Moc

ked

What part do expert testers play

• They should do what they always done, just sooner and more often

• They should be embedded in the team• More opportunities for better tests if they are

on-board from the start

Why bother…

25 February 2011 Daryn Holmes

Why bother…

25 February 2011 Daryn Holmes

• On 10 June 1990, an improperly installed pain of the windshield failed

– Plane was at 17300 feet• No loss of life– 2 people were seriously injured

Why bother…

25 February 2011 Daryn Holmes

• A replacement windscreen had been installed 27 hours before the flight

• 90 bolts– 84 were 0.66mm too small in diameter– 6 were 2.5mm too short

• Previous windscreen has been fitted with the wrong bolts

Why bother…• Investigators found found fault with British Airways'

policies, which should have required testing or verification by another individual for this critical task

• They found engineers were working by themselves, under extreme pressure

• Safety recommendations – British Airways should review their quality

assurance system and encourage engineers to provide feedback

Why bother…

Really?

– ToEven• When a number is halfway between two others, it is

rounded toward the nearest even number

– AwayFromZero• When a number is halfway between two others, it is

rounded toward the nearest number that is away from zero

What part do developers play

Develop Test Requirements(Spec)

Nr.

Of S

torie

s

What part do developers play

Develop Test Requirements(Spec)

Nr.

Of S

torie

s

What part do developers play

Develop Test Requirements(Spec)

Nr.

Of S

torie

s

What part do developers play

Develop Test Requirements(Spec)

Nr.

Of S

torie

s

What part do developers play

Develop Test Requirements(Spec)

Nr.

Of S

torie

s

Crystal: Efficiency is expendable in non-bottle-neck activities

Barry Boehm, “Equity Keynote Address” March 19, 2007.

Steve McConnell, Software Quality At Top Speed, 1996http://www.stevemcconnell.com/articles/art04.htm

As a rule of thumb, every hour you spend on defect prevention will reduce your repair time from three to ten hours

Should Start-ups Use TDD?

http://www.redhills.ie/2012/08/08/should-a-startup-use-tdd/

Should Start-ups Use TDD?

http://www.redhills.ie/2012/08/08/should-a-startup-use-tdd/

Introducing ATDD

• At the start of a project• Introducing it on an existing project

• Outside in

TDD Culture

It’s not about the technology, it’s about the culture

TDD Culture

“The development team is responsible for first line support, 24/7”

- Steve Freeman

TDD Culture

“The development team is responsible for first line support, 24/7”

“Team members ended up volunteering to be on support over Christmas”

- Steve Freeman

Thank you…