If there are 1000 features files in Cucumber feature file and I want to execute only even feature files. how to do that?

177 Views Asked by At

1000 feature files in src/test/resources. I want to run only the features file which are even( 2, 4, 6,......1000) how can we do that?

I tried to group them but not sure like this will be good approach.

1

There are 1 best solutions below

0
M.P. Korstanje On BEST ANSWER

If you are using JUnit 5 with Cucumber the you can use a PostDiscoveryFilter from the JUnit Platform to filter out tests.

Something like:

public FilterResult apply(TestDescriptor t) {
   
   // Determine if test descriptor is a feature file based on t.getSource()

   Collection siblings = t.getParent().getChildren();

   // Find index of t in siblings
   // decide to keep or not if index is even


}