This document discusses acceptance test-driven development (ATDD) and how it can be used with SpecFlow and Fit frameworks. ATDD uses examples to collaboratively specify requirements and drive development. SpecFlow and Fit allow writing tests in a business-readable format and automatically generating test code. They integrate tests into development to validate functionality frequently. Overall, ATDD provides an executable specification, living documentation, and feedback to aid development.
ICT-palveluprosessit ja toiminnan tehostaminen: Ben Kalland, "Prosessien selk...
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
1. Acceptance Test
Driven
Development Régis
With VS 2012 Laurent
Director of Operations,
Global Knowledge
Juhani Lind 5-Mar-2013 Competencies include:
Gold Learning
Silver System Management
Tieturi Oy
2. Oh Brother, Where Did We Go Wrong?
… And
what was
finally delivered.
What
the Customer
described …
3. 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
5. Quick Overview
This is a team effort!
Requirement
Specification Implementing
+
by Examples
Acceptance
Examples as Tests
Criteria
List of Development
Requirements Next Requirement
(incl. implementation,
testing and reviews)
7. What actually gets driven by ATDD?
Architecture Collaboration
Design
Testable!
Implementation Testing
8. Two Examples of ATDD Tools
Fit
SpecFlow Framework for
Integrated Test
Binds business readable Integrates the work of
behaviour spesification customers, analysts,
and examples to .NET. testers and developers.
http://www.specflow.org/specflownew/ http://fit.c2.com/
9. Specification by Example in SpecFlow
Feature
Scenario 1
SpecFlow uses a business-readable Given
domain specific language called Gherkin When
to express examples and their Then
- preconditions (Given)
- actions (When) Scenario 2
- verification steps (Then) Given
When
Then
10. SpecFlow Overview
SpecFlow SpecFlow Feature
Auto-Generated Code (Gherkin) VS2012 Test Explorer
Runs tests
Implemented by
System Under Test
Code
Calls
Unit Test Provider User Written
(e.g. NUnit) Feature Code in .NET
15. The Hamlet Dilemma
To test through the UI or not to test – oh what a question.
Well … it depends …
16. Where To Look For Verification?
System Under Test
Presentation Business Logic Data
External System
17. From ATDD to Test Driven Development (TDD)
TDD Cycle
- Design with tests
- Implement tests
- Run one test to see it fail!
- Implement the simplest
solution
ATDD TDD - Run the test to see it pass!
- Refactor, repeat
This RED – GREEN – Refactor
cycle applies to both.
18. Specification by Example with Fit
<table>
Fit uses the classic HTML tables to <tr>
express examples. <td> </td>
The structure of HTML tables specify <td> </td>
- a Fit fixture <td> </td>
- preconditions and actions <td> </td>
- verification rules </tr>
</table>
19. FIT Overview
HTML Tables
Presentation Layer
- Examples Action Fixture
- Result
Injection to public variables.
Calls to public methods. Business Layer
Column Fixture
User Written
Fit Fixture <dll >
Data Layer
Row Fixture
System
Under
Test
24. Watch Your Language!
Specification and examples
should use the Customer’s language and terminology.
SpecFlow Fit
Gherkin itself has been translated to The names of
40 languages. - public variables and
The language is set in the config file - public methods
with the <language> element. in Fit fixtures should be as close to
the Customer’s language as
<language feature = ”fi-FI” /> possible.
25. But
something
else is
needed too!
Building the RIGHT solution …
… the RIGHT way!
ATDD!