29.2.12

Building The Right Code

Using white box tests, more specific xUnit tests, definitely help you to build the code right. However, in terms of business this is not enough; you can write tons of 100% test covered code, but it still not necessarily fulfils the actual business needs. This happens that often that people came up with new ideas helping to build the right code.
Currently there are three major concepts that are actually all very similar, but still with fine distinctions. The intend of this entry is to give you a brief introduction to these topics and their major focus.

Acceptance Test Driven Development  (ATDD)
ATDD is similar to TDD, but in a broader context. It starts with a discussion about the feature with the customer or product owner. Within this discussion examples are defined so the requirements get more clear for everyone, but especially for the programmers. After that, the lifecycle is similar to standard TDD:

The pictures is taken from this article.

Its main focus lies on automated tests that are integrated with the specification examples and the clearer targets for development.

Behavior Driven Development (BDD)
BDD is a concept introduced by Dan North, which focus lies on having an ubiquitous language that every stakeholder can easily understand. Furthermore, this language is used for defining specification examples using the given-when-then template:
Given the account is in credit
And the card is valid
When the customer requests cash
Then ensure the account is debite
Additionally, it concentrates on defining what the system should do (system-behavior-specification). Nevertheless, test automation also plays an important role.

Specification By Example (SBE)
The SBE concept is introduced by Gojko Adzic and is considered as documentation centric. It can be seen as a broader concept, where automated testing is "just" one part; it is actually not important if the BDD or ATDD approach is preferred, as both are totally valid. It's main focus lies on living documentation and the thereby created long term values like effective maintenance.
This picture is taken from Gojko Adzic's book.

In the following entries I will present tools like JBehave or FitNesse that can be used to implement these concepts and to illustrate how such specification examples look like.

Specification By Example - Gojko Adzic
Behavior Driven Development - Dan North
Acceptance Test Driven Development

No comments:

Post a Comment