Aga*_*oom 5 ruby bdd cucumber aruba
为了使用Cucumber作为命令行脚本,我按照提供的说明安装了aruba gem.它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了
require 'aruba/cucumber'
Run Code Online (Sandbox Code Playgroud)
在'features/env.rb'中
为了确保它的工作,我写了以下场景:
@announce
Scenario: Testing cucumber/aruba
Given a blank slate
Then the output from "ls -la" should contain "drw"
Run Code Online (Sandbox Code Playgroud)
假设事情应该失败.
它确实失败了,但由于错误的原因它失败了:
@announce
Scenario: Testing cucumber/aruba
Given a blank slate
Then the output from "ls -la" should contain "drw"
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[] (NoMethodError)
features/dataloader.feature:9:in `Then the output from "ls -la" should contain "drw"'
Run Code Online (Sandbox Code Playgroud)
任何人都有任何想法为什么这不起作用?这似乎是非常基本的阿鲁巴行为.
你错过了"何时"步骤 - aruba"输出应该包含"步骤要求命令已经运行(它本身不运行它,它只查找它).
@announce
Scenario: Testing cucumber/aruba
Given a blank slate
When I run `ls -la`
Then the output from "ls -la" should contain "drw"
Run Code Online (Sandbox Code Playgroud)
这在我的机器上产生:
@announce
Scenario: Testing cucumber/aruba # features/test_aruba.feature:8
When I run `ls -la` # aruba-0.4.11/lib/aruba/cucumber.rb:56
$ cd /Users/d.chetlin/dev/mine/ladder/tmp/aruba
$ ls -la
total 0
drwx------ 2 d.chetlin staff 68 Feb 15 23:38 .
drwx------ 7 d.chetlin staff 238 Feb 15 23:38 ..
Then the output from "ls -la" should contain "drw" # aruba-0.4.11/lib/aruba/cucumber.rb:86
1 scenario (1 passed)
2 steps (2 passed)
0m0.465s
Run Code Online (Sandbox Code Playgroud)