Running single cucumber feature doesn't load step definitions
I have a cucumber feature at features/object/create_object.feature. It passes when I execute all of my features with the 'cucumber' command. I'm trying to execute this feature by itself using these commands:
cucumber fe开发者_高级运维atures/object/create_object.feature
rake features FEATURE=features/object/create_object.feature
However, all step definitions for this feature come up as undefined:
Using the default profile...
-------UUUUUUUUUUUU
I've also tried disabling the profile with "--no-profile", but to no avail. Thanks in advance!
I think you need to tell cucumber how to locate the step definitions when running features in subdirectories of ./features
:
rake features FEATURE=features/object/create_object.feature REQUIRE=features
Using cucumber
from the command line per your example didn't work for me -- I had to add --require
:
cucumber --require features features/object/create_object.feature
More in this blog post.
Better approach is to update your add -r features to cucumber.yml file.
See Cucumber steps not automatically loaded when running features
I ran into the same problem but the require feature did not solve it Instead I got around the problem by using tags
So instead of calling
cucumber features/accounts.feature
I call
cucumber --tags @account features
where "@account" goes before the scenario
@current Scenario: Anonymous user can create an account Given an anonymous user
works fine. All steps.rb files are loaded
精彩评论