运行功能时未自动加载 Cucumber 步骤 [英] Cucumber steps not automatically loaded when running features

查看:18
本文介绍了运行功能时未自动加载 Cucumber 步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近更新了我机器上的 Cucumber gems('cucumber' 和 'cucumber-rails')并且遇到了几个问题.我目前正在努力的一个问题是,Cucumber 不会自动加载我的功能定义的任何步骤.这导致我的命令行告诉我可以使用这些片段为未定义的步骤实现步骤定义"对于我在功能中使用的每一个步骤.

I have recently updated the Cucumber gems ('cucumber' and 'cucumber-rails') on my machine and have run into a couple of issues. The one i am currently fighting is that none of the defined steps for my features are being automatically loaded by Cucumber. This results in my command line telling me i "can implement step definitions for undefined steps with these snippets" for every single step i use in my features.

我已经跑了:

cucumber --verbose

...并且可以看到以下内容:

...and can see the following:

代码:* 供应商/插件/回形针/黄瓜/paperclip_steps.rb

Code: * vendor/plugins/paperclip/cucumber/paperclip_steps.rb

但是,除非我指定要加载的文件,否则 Cucumber 不会加载任何步骤:

However, none of the steps are being loaded in by Cucumber unless i specify files to load:

cucumber -r features/step_definitions/web_steps.rb

我认为这可能只是我在应用程序结构的step_definitions"文件夹中创建的自定义步骤文件,但似乎也没有加载标准的web_steps"文件.

I thought this might just be the custom step files i had created within the "step_definitions" folder in my app structure but it would appear the standard "web_steps" file isnt being loaded either.

如果遇到此问题或知道为什么会发生这种情况,我们将不胜感激.

Would appreciate hearing from anyone who has come across this issue or knows why this might be happening.

谢谢.

推荐答案

好的,我暂时想出了一个解决方案.我不确定它是否正确.运行 cucumber 命令时简单禁用配置文件似乎可以确保为功能加载正确的步骤定义.

OK i have come up with a solution for this for the time being. Im not sure if its the right one or not. Simple disabling profiles when running the cucumber command seems to ensure that the correct step definitions are loaded for the features.

我现在可以运行我的测试了:

I can now run my tests with:

cucumber --no-profile

这篇关于运行功能时未自动加载 Cucumber 步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆