Software Development and QA Tips By QASource Experts

How To Order Feature Files in Cucumber Test Suite?

Written by Timothy Joseph | Feb 8, 2021 5:00:00 PM

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.