-
-
Save fivetanley/3490439 to your computer and use it in GitHub Desktop.
| #Brittle Example | |
| Feature: Automatically Update the Chat View | |
| Users should not have to refresh their browser to see the latest messages. | |
| Scenario: I send a message | |
| Given I am on the chatsite | |
| #Lower-level. Describes exact actions a user will execute in his/her browser. | |
| When I fill out the message body with "Hi everyone" | |
| And I click the "Send" button | |
| Then I should see "<example_username>Hi everyone" in the ChatView |
| #Higher level example | |
| Feature: Automatically Update the Chat View | |
| Users should not have to refresh their browser to see the latest messages. | |
| Scenario: I send a message | |
| Given I am on the chatsite | |
| When I send a Message #very high level, does not explain user's browser actions. | |
| Then I should see my Message |
Oh and ChatView looks like a technical thingy. Couldn't you drop it?
How about this: Then I see my message
Will change. Thanks a lot!
Note that in your /^I see my message$/step definition, you can still assert several truths:
- your message is displayed
- your ID is displayed next to it
But these implementation details should probably not surface in the scenarios.
Thanks much, it really helps out a new guy who doesn't fully understand this stuff yet.
Do you have any resources where I can learn good practices for these higher-level Cucumber tests?
The most complete, though not free, one is The Cucumber Book. There is this interesting blogpost by Aslak too. The #cucumber IRC channel can be useful too (not super active, but patience can lead to results ;)). The mailing list is a good source of info too.
That's a lot of toos.
Awesome, thanks so much!
What about this: