Search code examples
cucumbercucumber-jvmcucumber-javacucumber-junitcucumber-serenity

How can we run only specific cukes with Cucumber


I do understand that cucumber itself not providing any such functionality where we can run specific few cukes from cucumber.

Note: from cukes I meant multiple folder having different feature files

For Example:

Folder1:

    -> one.feature 

    -> two.feature 

Folder2:

    -> three.feature 

    -> four.feature 

Folder3:

    -> five.feature 

    -> six.feature

Now suppose if I like to run only Folder1 and Folder2 without specify any tag in cucumber file then how we can achieve it in cucumber

I like to execute few cukes folder not all of them and I do understand that I need to override the current functionality of cucumber for same.

I would like to know if someone already done it already, if yes please share with us.

I also like to know how I can trigger same from maven command


Solution

  • U can use the features option of CucumberOptions -

    @CucumberOptions(features = {"src/test/resources/first","src/test/resources/second"})

    From the maven command-

    mvn test -Dcucumber.options="src/test/resources/first src/test/resources/second"