Created
August 27, 2012 17:06
-
-
Save fivetanley/3490439 to your computer and use it in GitHub Desktop.
Cucumber Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
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!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh and
ChatView
looks like a technical thingy. Couldn't you drop it?How about this:
Then I see my message