Using Cucumber
In using cucumber test you could watch
here. Also you could refer to these (
Github Capyara,
cucumber capybara bdd tutorial,
how to add first cucumber test to your rails app,
capybara and cucumber for newbies. ) links in building test.
And now, I wrote a sample steps in creating you cucumber test.
In your gemfile, make sure that you have these gems and installed.
group :test do
gem 'cucumber-rails', require: false
gem ‘selenium-webdriver’
gem 'database_cleaner’
end
Other steps to perform in creating your cucumber test:
bundle install
rails g
this shows you what are installed
rails g cucumber:install
touch features/add_items.feature
do your cucumber test
run rake db:create && rake db:migrate
rake cucumber
then, copy all the steps generated from rake cucumber in console, in sample case: #1
You can implement step definitions for undefined steps with these snippets:
Given(/^I'm logged in as a parent$/) do
pending # express the regexp above with the code you wish you had
end
When(/^I add a non\-recalled item$/) do
pending # express the regexp above with the code you wish you had
end
:
:
:
then, touch features/step_definitions/item_steps.rb then paste #1 in this file.
No comments:
Post a Comment