当我执行以下黄瓜脚本时:
Feature: Manage Customers
In order to store customers
As a user
I want to create and manage customers
Scenario Outline: Create Customer
Given I am on new customer screen
When I fill in Name with "Test Company"
And I press "Create"
Then I should see "Customer created successfully"我收到以下信息:
When /^I fill in Name with "([^"]*)"$/ do |arg1|
pending # express the regexp above with the code you wish you had
end但是,我使用的是webrat,在web_steps.rb中,它似乎没有识别这一行:
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
fill_in(field, :with => value)
end我检查了我的features/support/env.rb和webrat似乎是正确的要求:
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/world'
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'
require 'webrat'
require 'webrat/core/matchers'
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false # Set to true if you want error pages to pop up in the browser
end有什么想法吗?
发布于 2010-08-21 15:21:55
web_steps.rb中的步骤期望在fill in之后有一个引用的值,即您必须更改:
When I fill in Name with "Test Company"至
When I fill in "Name" with "Test Company"而且应该得到认可。
https://stackoverflow.com/questions/3537846
复制相似问题