How To Order Feature Files in Cucumber Test Suite?

Timothy Joseph | February 8, 2021

How To Order Feature Files in Cucumber Test Suite?

Cucumber feature files are run in Alphabetical order by feature file name as default. But if you want to try something different by changing the order i.e. by changing the order of the scenarios -- order = random etc.

Also you can try using hooks in order to pre-define the execution order of the hooks such as:

@Before(order = int) : This runs in increment order, means value 0 would run first and 1 would be after 0.

@After(order = int) : This runs in decrements order, means apposite of @Before. 1 run first and 0 be after 1.


This publication is for informational purposes only, and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.

Post a Comment