Discovery Issues

Test engines may encounter issues during test discovery. For example, the declaration of a test class or method may be invalid. To avoid such issues from going unnoticed, the JUnit Platform provides a mechanism for test engines to report them with different severity levels:

INFO

Indicates that the engine encountered something that could be potentially problematic, but could also happen due to a valid setup or configuration.

WARNING

Indicates that the engine encountered something that is problematic and might lead to unexpected behavior or will be removed or changed in a future release.

ERROR

Indicates that the engine encountered something that is definitely problematic and will lead to unexpected behavior.

If an engine reports an issue with a severity equal to or higher than a configurable critical severity, its tests will not be executed. Instead, the engine will be reported as failed during execution with a DiscoveryIssueException listing all critical issues. Non-critical issues will be logged but will not prevent the engine from executing its tests. The junit.platform.discovery.issue.severity.critical configuration parameter can be used to set the critical severity level. Currently, the default value is ERROR but it may be changed in a future release.

To surface all discovery issues in your project, it is recommended to set the junit.platform.discovery.issue.severity.critical configuration parameter to INFO.

In addition, registered LauncherDiscoveryListener implementations can receive discovery issues via the issueEncountered() method. This allows IDEs and build tools to report issues to the user in a more user-friendly way. For example, IDEs may choose to display all issues in a list or table.