Cucumber and Tips(briefly)
Scenarios <ul><li>Written in YAML
Scenario: Eat Cake </li><ul><ul><li>given there is cake
when I go to the cake page
and I press “Eat Cake”
then I should see “There is no more cake” </li></ul></ul><li>Get clients or stakeholders in on the writing process. </li><...
Steps <ul>When  /^I go to (.+)$/  do |page_name| visit path_to(page_name) end Generic is better. </ul>
Upcoming SlideShare
Loading in …5
×

Wellrailed - Cucumber tips

1,025 views

Published on

Published in: Technology, Self Improvement
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,025
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Wellrailed - Cucumber tips

  1. 1. Cucumber and Tips(briefly)
  2. 2. Scenarios <ul><li>Written in YAML
  3. 3. Scenario: Eat Cake </li><ul><ul><li>given there is cake
  4. 4. when I go to the cake page
  5. 5. and I press “Eat Cake”
  6. 6. then I should see “There is no more cake” </li></ul></ul><li>Get clients or stakeholders in on the writing process. </li></ul>
  7. 7. Steps <ul>When /^I go to (.+)$/ do |page_name| visit path_to(page_name) end Generic is better. </ul>
  8. 8. Dealing with slow test suites Just target one feature: Cucumber features/feature.rb Specify by line number: Cucumber features/feature.rb:2:29
  9. 9. Avoid Excessive Givens <ul><li>Each given loads data and is held in a transaction for the scenario.
  10. 10. Seed data where possible rather than establishing it in givens </li></ul>
  11. 11. Tagging features <ul><li>Tag features and scenarios with : </li><ul><li>@tag @tag2
  12. 12. Feature: cake </li></ul><li>Run specific tags with: </li><ul><li>cucumber --tags @tag </li></ul><li>The @wip tag is special for WIP. </li></ul>
  13. 13. Validate your HTML <ul><li>Throw in a step to validate your HTML </li><ul><li>markup_validity gem
  14. 14. Then %r/the page is valid XHTML/ do
  15. 15. $browser.html.should be_xhtml_strict if ENV[&quot;VALIDATION&quot;]
  16. 16. end </li></ul><li>Equal opportunity for front end people to get laughed at for breaking the build. </li></ul>

×