运行功能时不会自动加载 Cucumber 步骤
我最近更新了我机器上的 Cucumber gems(“cucumber”和“cucumber-rails”),但遇到了一些问题。我目前面临的问题是,Cucumber 没有自动加载我的功能的任何定义步骤。这导致我的命令行告诉我,对于我在功能中使用的每个步骤,“可以使用这些片段实现未定义步骤的步骤定义”。
我已经运行:
cucumber --verbose
...并且可以看到以下内容:
代码: *vendor/plugins/paperclip/cucumber/paperclip_steps.rb
但是,除非我指定要加载的文件,否则 Cucumber 不会加载任何步骤:
cucumber -r features/step_definitions/web_steps.rb
我认为这可能只是我在“step_definitions”文件夹中创建的自定义步骤文件在我的应用程序结构中,但标准的“web_steps”文件似乎也没有被加载。
如果有人遇到过此问题或知道为什么会发生这种情况,我们将不胜感激。
谢谢。
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.
I have run:
cucumber --verbose
...and can see the following:
Code:
* vendor/plugins/paperclip/cucumber/paperclip_steps.rb
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
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.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 -r feature 包含到 cucumber.yml 文件中,以便 cucumber 加载 feature/ 目录中的所有步骤定义。添加到上面的 std_opts 中。请参阅下面附加的 cucumber.yml 文件。
You can include -r feature into your cucumber.yml file such that cucumber loads all the step definitions in feature/ directory. Append above in std_opts. See appended cucumber.yml file below.
好的,我暂时想出了一个解决方案。我不确定它是否正确。运行 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: