Is there any way to run Cucumber tests from parent folder of features folder?

2.2k Views Asked by At

I am trying to run a git bisect while using our automated tests to check the commit if it is the one causing the defect. The structure of our program is:

app
  - cucumber_tests
    - features/
      - main_features/
    - cucumber.yml
  - src/

Obviously this is not the default/standard folder structure for running Cucumber tests as you would want the features folder to be at top-level of your app. This was not my choice and cannot be changed.

I can run the tests by cd into cucumber_test and then run. However, in order to run git bisect it must be done at same level as the .git folder.

My question is: is there a way to run the Cucumber tests from a parent directory of the features folder in Cucumber? Being able to read the cucumber.yml file would also be very beneficial.

Is there a way to tell Cucumber that you are not using the standard folder structure?

Edit: I have been able to get the tests started by using cucumber -r cucumber_tests/features cucumber_tests/features/main_features/first.feature. However, it is unable to find some of the step definitions part-way through the test.

It appears that cucumber is looking for files in app/features not app/cucumber_tests/features

1

There are 1 best solutions below

0
On

You can still use the same folder structure. But you need to change the parameters in order to run your features. Otherwise this will not load step definitions. I hope you have step definitions inside the features folder. So now use this command to run the features: cucumber -r <absolute path of the features folder[C:\users\xyz\project\some_folder\features] absolute_path_feature_file[C:\users\xyz\project\some_folder\features\example.feature] This way you cucumber will load your step definitions even if you have a different folder structure.