最近,有时间在参考UC berkeley一个免费在线Ruby学习课程
[url]https://www.coursera.org/saas/class/index[/url]
写了点Cucumber测试有些心得
如果有如下的类似错误,是因为使用了steps
[quote] Then I should not see any movie # features/step_definitions/movie_steps.rb:22
Lexing error on line 1: 'I should not see "Aladdin"'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)[/quote]
另外一个例子
错误提示
[quote]Given a nested task # step_definitions/test_steps.rb:10
Lexing error on line 4: ''. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)
./step_definitions/test_steps.rb:14:in `/^a nested task$/'
./test_case.feature:8:in `Given a nested task'
When I call another nested task # step_definitions/test_steps.rb:17
Then everything fails # step_definitions/test_steps.rb:25[/quote]
一种解决办法重现编译1.9.3 with
[url]https://www.coursera.org/saas/class/index[/url]
写了点Cucumber测试有些心得
When /^I make all my stuff shiny$/
step "I polish my first thing"
end
When /^I make all my stuff shiny$/
steps %Q{
When I polish my first thing
When I shine my second thing
}
end
如果有如下的类似错误,是因为使用了steps
[quote] Then I should not see any movie # features/step_definitions/movie_steps.rb:22
Lexing error on line 1: 'I should not see "Aladdin"'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)[/quote]
另外一个例子
Feature: Test case
As a cucumber user
I want to crash MRI 1.9.3
So I can provide a small failing test case
Scenario: successfully crash MRI
Given a nested task
When I call another nested task
Then everything fails
#==========================
require 'capybara'
require 'capybara/dsl'
require 'capybara-webkit'
Capybara.default_driver = :selenium
Capybara.app_host = 'http://www.google.com'
include Capybara::DSL
Given /^a nested task$/ do
steps %Q{
Given I call "first" nested task
And "second" nested task
}
end
When /^I call another nested task$/ do
steps %Q{
When I call subtask "1"
And I call subtask "2"
And "third" nested task
}
end
Then /^everything fails$/ do
end
Given /^I call "([^"]*)" nested task$/ do |arg1|
Kernel.puts "Nested task " + arg1
visit '/'
end
Given /^"([^"]*)" nested task$/ do |arg1|
Kernel.puts arg1 + " nested task"
end
When /^I call subtask "([^"]*)"$/ do |arg1|
Kernel.puts "subtask " + arg1
end
错误提示
[quote]Given a nested task # step_definitions/test_steps.rb:10
Lexing error on line 4: ''. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)
./step_definitions/test_steps.rb:14:in `/^a nested task$/'
./test_case.feature:8:in `Given a nested task'
When I call another nested task # step_definitions/test_steps.rb:17
Then everything fails # step_definitions/test_steps.rb:25[/quote]
一种解决办法重现编译1.9.3 with
CC=clang ./configure
and
$ gem pristine ffi