Ruby on Rails:Cucumber:如何 Rake 单个功能?

发布于 2024-09-07 00:10:23 字数 69 浏览 1 评论 0原文

我想单独运行它们的原因是因为我需要在我的 Rake 文件中单独设置它们,因为当我一起运行它们时,我的 Java 堆空间被填满

Reason why I want to run them individually, is because I need to have them individually set up in my Rake file, because, My Java Heap Space fills up when I run them all together

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

东走西顾 2024-09-14 00:10:23

正确的方法是使用 cucumber 可执行文件(如果您使用的是 Rails 2)来运行它,或者使用 bundle exec cucumber(如果您使用的是 Rails 3(以及 Bundler))来运行它。

运行特定功能:

[command] features/signing_in.feature

要从该功能运行特定场景:

[command] features/signing_in.feature:6

行号可以是该功能内的任何行,但通常是第一行。

如果您运行rake cucumber:ok并且某些场景失败,在输出的底部您将看到类似这样的内容:

cucumber features/sigining_in.feature:6 # Signing in via form

您可以三次单击此行并将其粘贴到终端中以运行该场景。

The correct way is to run it using the cucumber executable if you're using Rails 2, or bundle exec cucumber if you're using Rails 3 (and thus Bundler).

To run a specific feature:

[command] features/signing_in.feature

To run a specific scenario from that feature:

[command] features/signing_in.feature:6

The line number can be any line inside that feature, but is usually the first line.

If you run rake cucumber:ok and some scenarios fail, at the bottom of the output you will see something like this:

cucumber features/sigining_in.feature:6 # Signing in via form

You can triple-click this line and paste it into your terminal to just run that scenario.

可可 2024-09-14 00:10:23

要直接回答 Rake 问题,您可以使用:

rake FEATURE=features/adding_products.feature cucumber

但是 使用 Rake wiki 页面建议不要在 CI 服务器上以外的任何地方使用 rake,因为它启动速度较慢。只需使用 cucumber 命令行即可,即:

cucumber features/adding_products.feature

或者,如果您必须:

bundle exec cucumber features/adding_products.feature

To answer the Rake question directly, you can use:

rake FEATURE=features/adding_products.feature cucumber

but the Using Rake wiki page advises against using rake for anything but on a CI server because it's slower to start. Just use the cucumber command line instead, i.e.:

cucumber features/adding_products.feature

or, if you must:

bundle exec cucumber features/adding_products.feature
指尖凝香 2024-09-14 00:10:23

耙子对我不起作用。
只需用bundle exec替换rake,就可以了。
下面是一个示例。

bundle exec cucumber features/users/signup.feature --require features

The rake did not worked for me.
Just replaced the rake with bundle exec, and it worked.
below is a sample.

bundle exec cucumber features/users/signup.feature --require features

两人的回忆 2024-09-14 00:10:23

我不确定在提出问题时黄瓜的 标签功能 是否可用,但我更喜欢设置@active 标签

  @active
  Feature ..

  @active
  Scenario ..

  cucumber --tags @active

I'm not sure cucumber's tag feature was available when the question asked, but i prefer setting @active tag

  @active
  Feature ..

or

  @active
  Scenario ..

and

  cucumber --tags @active
心的位置 2024-09-14 00:10:23

我喜欢简短的命令 $ cucumber -n

如果:

Feature: Manage Contents
  In order to manage instances from custom content types
  …

那么:

$ cucumber -n "Manage Contents"

I like the short command $ cucumber -n.

If:

Feature: Manage Contents
  In order to manage instances from custom content types
  …

Then:

$ cucumber -n "Manage Contents"
御弟哥哥 2024-09-14 00:10:23

运行单个功能文件。

cucumber /project folder/features/featurefile.feature

运行特定场景:

cucumber /project folder/features/featurefile.feature:10

其中 10 是场景行。

如果您使用捆绑器,

bundle exec cucumber /projectfolder/features/featurefile.feature

To run a single feature file.

cucumber /project folder/features/featurefile.feature

To run particular scenario:

cucumber /project folder/features/featurefile.feature:10

where 10 is the line of scenario.

If you use bundler,

bundle exec cucumber /project folder/features/featurefile.feature

橘亓 2024-09-14 00:10:23

您可以使用 script/cucumber 来处理单个文件。

假设您位于项目的根目录中并且有一个 features 文件夹:

./script/cucumber features/adding_products.feature

编辑:重新阅读您的问题后,您是否想要执行单独的功能或场景?

You can use script/cucumber to do individual files.

Assuming you are in the root directory of your project and you have a features folder:

./script/cucumber features/adding_products.feature

Edit: After re-reading your question, are you looking to do individual features, or scenarios?

不爱素颜 2024-09-14 00:10:23

如果您使用 cuke4duke,您可以与 ant 或 maven 分开运行它。

手册指出您可以使用与 Cucumber 相同的选项。所以我希望您可以传递要在命令行上运行的功能的文件名。

If you use cuke4duke you can run this separately from ant or maven.

The manual states that you can use the same options as cucumber. So I would expect you can pas the filename of the feature you want to run on the commandline.

风透绣罗衣 2024-09-14 00:10:23

当您在大型企业中有多个黄瓜项目时,通常需要的参数是
1)在哪里运行测试
2) 运行环境
3)哪个浏览器
4)什么标签

下面是一个非常灵活的模式,可以根据您的需要以多种方式使用。
此模式可用于在本地运行,针对硒网格,针对 Saucelabs 以及在持续集成环境中

http://seleniumframework.wordpress.com/2014/05/18/pattern-for-running-multiple-cucumber-projects-on-ci-服务器/

The parameters generally required when you have multiple cucumber projects in a large scale enterprise are
1) where to run the tests
2) Which environment to run against
3) Which browser
4) What tags

Below is a pattern that is very flexible and can be used in multiple ways based on your needs.
This pattern can be used to run locally, against a selenium grid, against saucelabs and in a continuous integration environment

http://seleniumframework.wordpress.com/2014/05/18/pattern-for-running-multiple-cucumber-projects-on-ci-server/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文