0

我想为 Ruby 中的 Cucumber 开发一些可重用的步骤定义和场景大纲。

我已经搜索了Cucumber wiki,但似乎没有关于使用 Cucumber 和 Ruby gems 的信息。

是否支持从已安装的 Gem 执行功能?

或者用户是否必须手动更改到 gem 安装目录并明确引用要从那里运行的功能?

4

3 回答 3

3

如果我正确理解了您的问题,您只需为可重用的定义和步骤创建一些库,然后在features/support/env.rb

这是一个与您需要完全相同的 gem,您可以将其用作参考:https ://github.com/jayzes/cucumber-api-steps

查看此 gem 提供的功能:https ://github.com/jayzes/cucumber-api-steps/blob/master/features/request.feature该 gem 创建了一些可重用的部分。

于 2012-12-10T14:12:07.180 回答
1

Turns out cucumber --help shows the way:

cucumber -r gem-name feature-name.feature

UPDATE: This doesn't work. Any other suggestions?

于 2012-12-10T12:59:53.723 回答
0

There is a cucumber gem which installs the binary cucumber.

Running this command, will assume default settings. This means it will look under ./features relative to the current path for files with the .feature extension. It will expect ./features/step_definitions to hold files with *_step.rb, where it will search for steps.

Edit: never mind, I misread your question and thought you wanted to know about the cucumber gem and its default paths.

于 2012-12-10T13:00:09.780 回答