ATDD by Example: A Practical Guide to Acceptance Test-Driven Development (Fernando Lopez-Lezcano's Library)

ATDD by Example: A Practical Guide to Acceptance Test-Driven Development (Fernando Lopez-Lezcano's Library)

Author:Markus Gärtner
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2013-06-14T16:00:00+00:00


Summary

Let’s take a break. While doing so we should reflect over the past few minutes. We added a first crossing with two intersecting roads. We started to work our way from the light state and its changes to the controller, which has the responsibility for coordinating state changes between the two different directions, and preventing two opposing directions from showing the green light at the same time.

Example by example we first built everything into the glue code. After getting the acceptance tests to pass, we put on our designer hats and let our knowledge from implementing the glue code guide our next actions. This time we decided to refactor the code we had into a new concept within our design. While retrofitting unit tests to the code, we found out that we created a flawed design and changed the underlying design to express the intent more meaningfully. As a take-away, we found out that acceptance tests alone are not enough to guide our design. This is the main difference between TDD, which guides the design, and ATDD, which guides the requirements. TDD focuses on tiny unit tests. It thereby helps to move the design of the classes in a certain direction. ATDD, on the other hand, focuses on the requirements, the specification of the functionality. TDD deals with technical implementations; ATDD deals with acceptance criteria from a business perspective.

On the technology level, we saw decision tables used again, but also learned about scenario tables used similarly as decision tables. We could have transformed the successful tests for switching the first light as well and gotten rid of the last column merely mentioning the red state of the second light. We explicitly decided against this step, because this might obscure the outcome for the successful state changes for the test reader in the future. For the invalid state changes, the outcome is completely the same all the time. The decision to hide the repeated yellow blinking states was well put into the scenario table at this point. One additional reason to hide the yellow blink combination is that we now can change the representation of the invalid configuration in a single place for all tests that might be implemented in the future as well—as long as that scenario can be used.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.