Search code examples
cucumberrubymine

Use cucumber Tags in different feature file


Instead create multiple feature files is it possible to have just one feature file and another file where I can call different sequence of cucumber tags like:

@step1, @step2

@step1, @step2, @step3

@step1, @step2, @step3, @step4

So that I can just run this file from RubyMine?

Thanks


Solution

  • Of course you can put all the scenarios for a project in one file.

    But is it something that you want to do?

    Remember, Cucumber is a BDD tool designed to bridge conversive issues between the development team and the business people. Separating each feature into a new file means that the business can pull out an individual feature and view it when it is done, to understand why it is there in terms of business value, and when it needs improving it's easy to add to/edit the existing scenarios.

    Having them in the same file may make it easier for you, but when something fails, it'll be harder to find the issue when you have to scroll down a 10,000 line long file.

    Instead, improve your folder structure so that features are easier to find, and tag features and scenarios across the files. Create a bash script to run suites if you want to, or just use the command line: "cucumber --tags @tag1" for instance.