Where I start to experiment with Cucumber
Earlier today I made a mini-plea on Twitter for TDD references (specific to Rails 3) since I’m starting to build an app and should do it the ‘proper’ way. Ends up what I really wanted was BDD/ATDD references; specifically Cucumber + Rails 3.
Following the concept of Minimum Viable Product as a model I sketched out the first two Cucumber features while waiting for the boy at karate this morning. And already I had one of those ‘oh, wait!’ moments by realizing I hadn’t done the ‘show the landing page’ stuff before the ‘signup’ parts.
So here are my features. Again, the eventual signup form will eventually have a tonne more information, but all I need right now is username and password.
Feature: Landing
In order to use test maps
As a user
I want to see the landing page
Scenario: Display landing page
Given user is not cookied
When user goes to site
Then landing page is displayed
Feature: Signup
In order to create test maps
As a new user
I want to register
Scenario: Display registration form
Given user is unregistered
When user clicks they want to signup
Then signup page is displayed
Scenario: Happy path signup
Given username is available
And password is strong
And password is verified
When user clicks signup
Then user is created
Scenario: Username available
Given username is already in use
And password is strong
And password is verified
When user clicks signup
Then message 'Username is not available' is displayed
Scenario: Password length
Given a password is too short
And password is verified
And username is available
When user clicks signup
Then message 'Password needs to be 5 or more characters' is displayed
Scenario: Password verification
Given a password is not verified
And password is strong
And username is available
When user clicks signup
Then message 'Password fields do not match' is displayed
Anyone have any stylistic suggestions?
Now all I need to do is implement the actual steps. Heh; all…