Tanuja doppalapudi
Tanuja doppalapudi

Reputation: 11

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

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.

Upvotes: 0

Views: 221

Answers (1)

M.P. Korstanje
M.P. Korstanje

Reputation: 12019

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


}

Upvotes: 0

Related Questions