cucumber and bdd

12
Cucumber and BDD Nashville Ruby on Rails meetup November 19, 2009 Josh Crews

Upload: joshcrews

Post on 15-Apr-2017

3.669 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Cucumber And Bdd

Cucumber and BDDNashville Ruby on Rails meetup

November 19, 2009Josh Crews

Page 2: Cucumber And Bdd

Behavior Driven Development (BDD)

first: describe what the software doessecond: write the code to fulfill it(behavior drives development)

Page 3: Cucumber And Bdd

BDD

Separate software design (one job)fromwriting code (a different job)

Page 4: Cucumber And Bdd

BDD - design example

Given I am a bureau owner When I go to the homepage And I am logged in When I go to the speakers page And I click on "Add a speaker" And I fill in "speaker_name" with "Tad" And I press "Create profile" Then I should see "Tad" And I should see "Exclusive with Steve's speakers"

Page 5: Cucumber And Bdd

Cucumber

software for BDD that takes plain english,Ruby translations of plain english,and runs integration test/stories against your application

Page 6: Cucumber And Bdd

Cucumber - step definition

Given /^I am a bureau owner$/ do bureau = Factory(:bureau, :name => "Steve's speakers") @user = Factory(:user, :bureau => bureau)end

Page 7: Cucumber And Bdd

Cucumber’s sidekick: webrat

Cucumber reads the storyWebrat drives the browser

When /^I go to (.+)$/ do |page_name| visit path_to(page_name)end

Page 8: Cucumber And Bdd

Cucumber benefits

Joy in programmingclears the mindcontrols feature-driftdefines mini-milestones and git commits

Page 9: Cucumber And Bdd

Cucumber benefits

Leaves a trail of feature-still-works guaranteesEasy re-factor with confidence

Page 10: Cucumber And Bdd

Cucumber setup

http://cukes.info/Railscasts #155, #159

Page 11: Cucumber And Bdd

Cucumber: other

Not a direct replacement for Test::Unit, Shoulda, RspecCucumber can run integration tests on any application (different languages or frameworks)

Page 12: Cucumber And Bdd

Cucumber: Let’s use it!

End of presentation--now to the terminal.