We have an internal tool that distributes hundreds of thousands of tests to cloud workers. I've written a tool that discovers all the tests that need to be run using a LauncherDiscoverRequest
, and everything is working. However, some of our tests (and test classes) are annotated with @Disabled
or @Ignore
. These tests are still discovered and assigned to test workers, but of course the tests don't do anything, so they're just wasting resources. I'd like to identify and filter these tests at discovery time, so that they aren't included in the TestPlan
.
I found JupiterTestDescriptor::shouldBeSkipped(JupiterEngineExecutionContext)
, but I don't see a good way to invoke that from, e.g., a PostDiscoveryFilter
.
I can use a custom PostDiscoveryFilter
to identify each test's source, and then use reflection to determine if the method or class is annotated, but that's hacky and doesn't cover the general case: there are other ways to disable tests.
What's the best way to filter out skipped tests at discovery time?