cucumber test  小心得

最近,有时间在参考UC berkeley一个免费在线Ruby学习课程
[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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值