Avoiding brittleness by layering automation code
One of the most frequent reasons why some organizations don't write verification code (or start writing it and later give up) is that they find it difficult and time-consuming to maintain the step definitions. Every time something trivial changes on the UI or some other part of the code base, it triggers a wave of changes across our verification code. This is an understandable concern. Spending a lot of time and effort keeping our step definitions up to date is a self-defeating process. We call this kind of high-maintenance verification code brittle, as every little change tends to break it.
The brittle step definition problem
Let's look at how brittleness occurs in our verification code. Consider this scenario, saved under features/ traveler_login.feature
:
Scenario: Successful log-in Given Traveller is at the log-in page When Traveller enters the correct username And Traveller enters the correct password And Traveller...