Following on from my last post, I wanted to mention a common anti-pattern that Kevin’s case against cucumber mentioned. Scenarios that are too focussed on the user interface. Scenarios written as an imperative set of instructions for a machine to follow.
Scenarios like this.
Given I go to the homepage And I fill in my username And I click sign in When I click "Accounts" Then I see "Current Account" And I see "Savings Account"
The problem here isn’t just isolated to the imperative style of this scenario, but also that the scenario is highly coupled to the view.
Testing through the view is something you have to be wary of with any tool. It’s slow and brittle. That isn’t to say it has no value, but you don’t need every test to go through the UI. Beware the ice cream cone anti-pattern.