ATDD with SpecFlow

Preview:

Citation preview

© Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com

SELA DEVELOPER PRACTICEDecember 20-24, 2015

Arnon Axelrod

Introduction to ATDD and SpecFlow

Agenda

Problems with regular development processes

ATDD

SpecFlow

ATDD SpecFlow

About myselfSenior Architect and Test Automation Team Lead at Sela Group

Professional Software Developer since 1995

Amateur programmer since ~1984 (age 11)

E-mail: arnona@sela.co.il Blog: http://blogs.microsoft.co.il/ArnonAPhone: 052-5327296

Problems with regular development processes

Problems with Waterfall

Hard to think of all the details aheadLong specs may contain contradictions that are hard to seeCommunication problemsMost problems are revealed too lateResistant to change

Problems with Agile

Requirements/Spec are often vagueNo document of the current expected stateChaotic designNot enough time to test

Challenges with Automated Tests

Testability of the SUTReliabilityMaintainabilityHard to investigateSensitive to small application changesMedium bugs tend to be ignored

Problems with Unit Tests

Does not test integrationCoupled to implementationTest technical details instead of user scenario

ATDD

What’s ATDD?

Acronym for “Acceptance Test Driven Development”

Other common names:BDD (Behavior Driven Design)SbE (Specification by Example)

Software Development methodology

Expands Agile

The ATDD ProcessUser Story

• Clear Business Value• Small!

Define “Done”• Collaboratively• As user scenario

Write Failing Automated Test

• Identical to DoD• Business Language

Develop• Make the tests pass• Keep all tests pass• Refactor as needed

Done• Demo• Exploratory• Get Feedback

Example

Definition of Done

How will the user use the solution? (examples!)

How can we demonstrate it?

How will we test it?

Definition of Done!

Benefits of ATDDFor the business / team:

Improves communication and collaboration

Fast customer feedback

Significantly Less bugs

Reliable automation

Accurate documentation

Changes are easy!

Happy Customers!

Benefits of ATDDFor Developers:

No more unclear requirements

Clear focus: make the tests pass!

Easy to keep the code clean

Less messing with bugs

Less debugging

Benefits of ATDDFor Testers:

Actual impact on quality!

No tedious test cycles

More time for exploratory

No more “it works on my machine”

Benefits of ATDDFor Automation Developers:

Actual impact on quality!

Tests are always green

SUT is always testable

No need for workarounds

Challenges of ATDD

Cultural change

Slicing the user stories

Defining the DoD

SPECFLOW

What is SpecFlow?

A tool for “Binding business requirements to .NET code”

Open Source project

Free

Visual Studio Plug-in

Cucumber for .Net

Demo

SpecFlow

SpecFlow allows us to use Business Requirements as Automatic Tests

These Requirements are constantly validated

This allows developers to refactor safely

Much less bugs!

Allows Continuous Delivery!

Questions