Discover and Execute Tests

Let's learn about the discover and execute tests in JUnit 5.

We'll cover the following

Discover tests

The TestEngine method discover is responsible for discovering tests.

  • The first parameter of the EngineDiscoveryRequest type represents the requests to discover tests.
  • The second parameter of type UniqueId should be used as the unique ID of the returned root, TestDescriptor.

An EngineDiscoveryRequest consists of selectors and filters.Selectors select resources to discover tests, while filters filter resources. Selectors should implement the DiscoverySelector interface, and filters should implement the DiscoveryFilter interface. The table below shows the methods of EngineDiscoveryRequest.

Get hands-on with 1200+ tech skills courses.