0

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.

  • What is "even feature file". "even" implies you have some order. How are your files orderer: by name, by size, by creation date? – Alexey R. Dec 06 '22 at 12:53

1 Answers1

0

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


}
M.P. Korstanje
  • 10,426
  • 3
  • 36
  • 58