Discovery Selectors

There is a newer version available.
For the latest stable release, please see JUnit 6.1.3!

The JUnit Platform provides a rich set of discovery selectors that can be used to specify which tests should be discovered or executed.

Discovery selectors can be created programmatically using the factory methods in the DiscoverySelectors class, specified declaratively via annotations when using the JUnit Platform Suite Engine, via options of the Console Launcher, or generically as strings via their identifiers.

The following discovery selectors are provided out of the box:

Java Type API Annotation Console Launcher Identifier

ClasspathResourceSelector

selectClasspathResource

@SelectClasspathResource

--select-resource /foo.csv

resource:/foo.csv

ClasspathRootSelector

selectClasspathRoots

 — 

--scan-classpath bin

classpath-root:bin

ClassSelector

selectClass

@SelectClasses

--select-class com.acme.Foo

class:com.acme.Foo