techdays 2013 juhani lind: acceptance test driven development with vs 2012

Post on 01-Nov-2014

905 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Régis Laurent Director of Operations, Global Knowledge Competencies include: Gold Learning Silver System Management

Acceptance Test Driven Development With VS 2012 Juhani Lind 5-Mar-2013 Tieturi Oy

Oh Brother, Where Did We Go Wrong?

What the Customer described …

… And what was

finally delivered.

ATDD - A Bridge Over Troubled Gap Using Tests As Specification! • Collaborative specification • Using examples to illustrate • Driving the development • Validating frequently

Ultimate Benefits! • Executable specification • Living, up-to-date documentation • Learning by getting feedback

So many names …

#td2013fi

Quick Overview

Requirement +

Acceptance Criteria

Specification by

Examples

Implementing Examples as Tests

List of Requirements

Development (incl. implementation, testing and reviews) Next Requirement

This is a team effort!

Constraints Matter Too!

Requirement Feature

Acceptance Criteria/

Constraints

Acceptance Criteria

+ Examples

Functionality

Performance Usability

Security …

What actually gets driven by ATDD?

Collaboration Architecture Design

Implementation Testing

Testable!

Two Examples of ATDD Tools

SpecFlow Fit Framework for Integrated Test

Binds business readable behaviour spesification and examples to .NET.

Integrates the work of customers, analysts,

testers and developers.

http://www.specflow.org/specflownew/ http://fit.c2.com/

Specification by Example in SpecFlow

SpecFlow uses a business-readable domain specific language called Gherkin to express examples and their - preconditions (Given) - actions (When) - verification steps (Then)

Feature Scenario 1

Given When Then

Scenario 2

Given When Then

SpecFlow Overview SpecFlow Feature

(Gherkin) SpecFlow

Auto-Generated Code

User Written Feature Code in .NET

VS2012 Test Explorer

Unit Test Provider (e.g. NUnit)

System Under Test Code

Runs tests

Implemented by

Calls

SpecFlow in Action 1: Examples with Gherkin

SpecFlow in Action 2: Generating Steps

SpecFlow in Action 3: Implementation in C#

SpecFlow in Action 4: Running scenarios

The Hamlet Dilemma

To test through the UI or not to test – oh what a question.

Well … it depends …

Where To Look For Verification?

Presentation Data Business Logic

System Under Test

External System

ATDD

From ATDD to Test Driven Development (TDD)

TDD

TDD Cycle - Design with tests - Implement tests - Run one test to see it fail! - Implement the simplest

solution - Run the test to see it pass! - Refactor, repeat

This RED – GREEN – Refactor cycle applies to both.

Specification by Example with Fit

Fit uses the classic HTML tables to express examples. The structure of HTML tables specify - a Fit fixture - preconditions and actions - verification rules

<table> <tr>

<td> </td> <td> </td> <td> </td> <td> </td>

</tr> </table>

FIT Overview HTML Tables - Examples - Result

User Written Fit Fixture <dll >

System Under Test

Action Fixture Presentation Layer

Business Layer

Data Layer

Column Fixture

Row Fixture

Injection to public variables. Calls to public methods.

Fit in Action 1: Examples as HTML Table

Fit in Action 2: Fixture Code

Fit in Action 3: Execution Command

Fit in Action 4: Result as HTML Table

Watch Your Language!

Gherkin itself has been translated to 40 languages. The language is set in the config file with the <language> element. <language feature = ”fi-FI” />

The names of - public variables and - public methods in Fit fixtures should be as close to the Customer’s language as possible.

SpecFlow Fit

Specification and examples should use the Customer’s language and terminology.

Building the RIGHT solution …

… the RIGHT way!

ATDD!

But something

else is needed too!

t

Q&A

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentations. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Thank you for coming! Feedback can be given via mobile or laptop through techdays.fi seminar schedule.

#td2013fi

top related