ATDD in practice
-
Upload
andrei-marukovich -
Category
Technology
-
view
2.170 -
download
0
description
Transcript of ATDD in practice
![Page 2: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/2.jpg)
2
Agenda
• What is Acceptance Test Driven Development?
• ATDD in depth
• SpecFlow demo
![Page 3: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/3.jpg)
3
Story of ProjectX
• Ingredients of success• Dedicated team and comfortable
schedule• Continues integration server• High Unit Tests coverage• Regular architecture reviews• Metrics analyzes
![Page 4: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/4.jpg)
4
Project was rejected by the customer
“Actually, we asked for something different”
![Page 5: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/5.jpg)
5
Reason of the failure
Sales Department
Development Team
Customer
1. Initial requirements
Lack of communication
2. Adjusted requirements
3. Wrong product
![Page 6: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/6.jpg)
6
ATDD is about…
• Communication
• Collaboration
• Process improvements
• Better specifications
![Page 7: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/7.jpg)
7
ATDD is not about frameworks
![Page 8: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/8.jpg)
8
Definition
• TDD helps to develop product right
• ATDD helps to develop right product
• Other names:• Behavior Driven Development• Specification by example• Executable specification
![Page 9: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/9.jpg)
9
ATDD and TDD
Develop
Deliver
Specify
Red
Green
Refactor
TDD
ATDD
![Page 10: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/10.jpg)
10
Specify
All stakeholders collaborate on specification
Domain Developers Testers
Define Clarify Verify
Specification
Specification based on common understanding
![Page 11: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/11.jpg)
11
Workshop types
• Full team
• Mini-team• 1 domain expert + 1 developer + 1
tester
• Pairing• Useful for extending existing
specifications
![Page 12: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/12.jpg)
12
Specification
• Use domain language
• Testable
• Includes scenarios and examples
![Page 13: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/13.jpg)
13
Specification example
Feature: New user registration In order to be able to use site As a new user I want to be able to register an account
Scenario: Successful registration Given I am on Registration page When I entered unique name And I entered valid password Then a new account is created
![Page 14: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/14.jpg)
14
Executable specification benefits
• Better definition of scope and “done”
• More scenarios identified upfront
• Preventing defects is cheaper than fixing them
• Prevents system regression
![Page 15: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/15.jpg)
15
What to specify
• User Interface?
• Business logic?
• Data access layer?
• Algorithms?
Everything, if it make sense for customer
![Page 16: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/16.jpg)
16
Consider maintenance cost
UI and AlgorithmsBusiness logic and DAL
![Page 17: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/17.jpg)
17
How to specify
• Define system behavior, not steps• Simplifies long term maintenance• Captures domain knowledge
• Do not rely on implementation details
• Test should be self-describing• Define allowed and disallowed scenarios• Provide right and failing examples
• Use iterative approach• Start with defining of the happy path
• Use domain language
![Page 18: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/18.jpg)
18
What’s next?
It’s time to automate your specifications
![Page 19: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/19.jpg)
19
Frameworks - FIT
![Page 20: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/20.jpg)
20
Fixture implementation
FIT Fixture Production Code
![Page 21: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/21.jpg)
21
FIT Action fixture
![Page 22: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/22.jpg)
22
Given-When-Then frameworks• Cucumber
• Cuke4Nuke
• SpecFlow
![Page 23: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/23.jpg)
23
Gherkin style specification
Feature: New user registration In order to be able to use site As a new user I want to be able to register an account
Scenario: Successful registration Given I am on Registration page When I entered unique name And I entered valid password Then a new account is created
![Page 24: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/24.jpg)
24
Demo
SpecFlow demo
![Page 25: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/25.jpg)
25
Test maintenance
• Automation code is code – follow all good habits
• Document building blocks
• Split the test – fast, slow, stable
• ATDD can be used for integration but keep integration and functional tests separately
![Page 26: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/26.jpg)
26
Way for a better specifications• Collaborative approach
• Specify behavior, not implementation
• Testable requirements
• Automate specification tests
• Control specification maintainability
![Page 27: ATDD in practice](https://reader033.fdocuments.us/reader033/viewer/2022061112/5457937faf79594e128b4918/html5/thumbnails/27.jpg)
Thank you!
27
lunarfrog.com/blog
@amarukovich