Skip to content

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Surefire Progress Reporter

CI License: MIT

A small Surefire 3.5.6 console reporter extension that preserves Surefire's normal per-suite output and adds run-wide suite progress:

[PROGRESS] Discovered 217 eligible test suites
Running ExampleTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 s -- in ExampleTest
[PROGRESS] Suites 1/217 (0.5%) | elapsed 00:01

The denominator is the number of compiled classes matching Surefire's default suite filename conventions: Test*, *Test, *Tests, and *TestCase. Inner classes are excluded. It is intentionally described as the number of eligible suites: a test provider can still reject an abstract or otherwise non-runnable candidate.

Requirements

Reporter version Maven Surefire Java
0.1.1 3.5.6 11 or later

The reporter targets Surefire 3.5.6 exactly because Surefire's reporter extension API is not promised to remain compatible between releases.

Installation

The reporter is published to Maven Central. Declare it as a dependency of maven-surefire-plugin as shown below; there is nothing else to install.

To try an unreleased change, clone the repository and install the snapshot in your local Maven repository instead:

git clone https://github.com/Gems/maven-surefire-progress-reporter.git
cd maven-surefire-progress-reporter
mvn install

Configure Surefire

The reporter artifact must be a dependency of maven-surefire-plugin, not a project dependency:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.5.6</version>
  <dependencies>
    <dependency>
      <groupId>io.github.gems</groupId>
      <artifactId>maven-surefire-progress-reporter</artifactId>
      <version>0.1.1</version>
    </dependency>
  </dependencies>
  <configuration>
    <statelessTestsetInfoReporter implementation="io.github.gems.surefire.progress.ProgressStatelessTestsetInfoReporter">
      <testClassesDirectory>${project.build.testOutputDirectory}</testClassesDirectory>
      <usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
      <usePhrasedClassNameInTestCaseSummary>true</usePhrasedClassNameInTestCaseSummary>
    </statelessTestsetInfoReporter>
  </configuration>
</plugin>

The plugin dependency and reporter implementation are required. Configure testClassesDirectory to calculate a numeric total; without it, progress still works but displays an unknown total. The two usePhrasedClassName... options are optional and only control how JUnit display names appear in Surefire's normal output.

Behavior

  • Prints the discovered eligible-suite total when Surefire initializes the reporter.
  • Appends a progress line after each distinct completed suite while preserving Surefire's normal console and file reports.
  • Counts suites rather than individual test methods.
  • Attributes a nested class, which completes as a test set of its own under a name such as ExampleTest$Nested, to its top-level suite, so the completed count and the total count the same thing.
  • Ignores duplicate suite-completion events within a fork, such as reruns, when advancing progress.
  • Shows ? for the total and percentage when the compiled test directory is not configured or cannot be scanned, and warns why. A directory that is scanned successfully but holds no matching class file reports a total of 0.

Limitations

  • The total is an estimate based on Surefire's default class-name conventions. Custom includes and excludes are not applied to the scan.
  • Provider-specific discovery can reject an eligible class, for example when it is abstract or otherwise not runnable.
  • Tests whose class names do not follow the default conventions are not included in the total, even if custom Surefire configuration executes them.
  • Compatibility with Surefire versions other than 3.5.6 is not supported.
  • A provider that reports whole suites instead of classes, as parallel TestNG suites do by all reporting the name TestSuite, advances progress once per suite against a total counted in classes.

These limitations affect only the reported progress. They do not change which tests Surefire executes or how it records their results.

Development

Build the project and run its tests with:

mvn verify

Install the development snapshot locally with mvn install when testing the reporter in another Maven project.

License

This project is available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages