apache / apache/maven-surefire

[SUREFIRE-2071] failIfNoTests config option to fail when no tests are found (in a given module)

Open
#3,124 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Marcin Zajaczkowski](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=szpak)** opened **[SUREFIRE-2071](https://issues.apache.org/jira/browse/SUREFIRE-2071?redirect=false)** and commented

TL;TR. When enabled, failIfNoTests set to "true" in the Surefire (also Failsafe?) configuration should fail its execution when no tests found in a given module.

Rationale. Recently, adding SonarQube reporting in a multi module Maven project (which I didn't know well), I was surprised that the XML reports (from JUnit 5) on CI are generated only for one module. After some investigation, I've noticed that due to migration to JUnit Platform in that one module, tests in JUnit 4 from the other modules were not executed at all (in Maven/Surefire) due to dependency misconfiguration. However, they were executed fine in Idea.

With that flag (hopefully enabled by default in Surefire 3.0-final), people making a migration would be alarmed about the problem - 0 tests in some module. Without that, the problem could be hidden for some time (if developers run them from IDE).

---

**Affects:** 3.0.0-M6

Contributor guide

Open the contributing guide

Research direction

Start by reading the requested failIfNoTests behavior for Surefire and the possible Failsafe counterpart, then inspect how test execution is configured across Maven modules. Clarify whether the option should be enabled by default and what counts as no tests, including JUnit 4 and JUnit 5 migration cases. Done means a module with no discovered tests fails when enabled, with the behavior covered for the relevant plugin configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.