How to run multiple feature files in a specific sequence using cucumber runner class?

How can we run multiple feature files in specific sequence with CucumberRunner class ?

e.g:- if I have 3 feature files (File1.feature, File2.feature, File3.feature)

Then how I can run these files in a following sequence ?

File 1 then File 3 then File 2


  • Cucumber scenarios must be decoupled and independent of each other, hence it must make no difference in what order they will run. If you have scenarios that depend on previously executed ones, I suggest to review your design.

Cucumber features/scenarios are run in Alphabetical order by feature file name.

If you still in a particular order-

if you specifically specify features, they should be run in the order as declared. For example:

@Cucumber.Options(features={"File1.feature", "File3.feature","File2.feature"})

Hope this helps!


I have tried below example but it does not work for me:-

@CucumberOptions(features = [“File1.feature”, “File3.feature”,“File2.feature”], glue = “”, plugin= [“pretty”,“html:CucumberReports”, “json:CucumberReports/Cucumber.json”], tags="@PostiveScenarios")
public class SampleTest {}

All feature files run in alphabetical order and not the in the sequence that I have given in the CucumberOptions.

Is there any other way ?

Yes. Changing the order of the items in the CucumberOptions had no effect on order of execution, annoyingly. Renaming the tests so that they were alphabetically ordered did the trick, as I mentioned. Interestingly, the alphabetical ordering must be by ascii.

It’s unpleasant and hacky, but it gets the job done.

Yes, I have renamed it to 01_File1,02_File3 and 03_File2. It is working now