Skip to content

Move the parameter-only ITs to unit tests and unify the test style #1414

Closed

Description

@slachiewicz

The plugin has 251 integration tests, and each one is a separate Maven run of a few seconds. Many of them test a combination of parameters on a single POM, which a unit test covers as well, in a fraction of the time and with a readable failure. This issue tracks moving those to unit tests and unifying how both kinds of test are written.

What the ITs do

Group ITs Plan
One goal on one POM, checks the rewritten pom.xml 135 split below
display-* goals, check the log or the output file 43 split below
Several Maven runs in one IT 19 keep
Multi-module projects 30 keep
Site and reports 18 keep
Settings, offline mode, .mvn 6 keep

Of the 178 single-run ITs, 67 depend only on the available versions and the goal's parameters. Those can move to parameterized unit tests built on MockUtils and TestChangeRecorder, which the existing mojo tests already use:

  • update-properties (16): the allowMajorUpdates, allowMinorUpdates and allowIncrementalUpdates combinations, includes, excludes and single-version ranges. UpdatePropertiesMojoTest has 6 tests and none for includes or excludes.
  • display-dependency-updates (16): the issue-318 filters and the issue-34 process* flags, much of which DisplayDependencyUpdatesMojoTest already covers.
  • display-plugin-updates (8), use-latest-* and use-next-* (16), compare-dependencies (5), and a few set and update-property ITs.

The other 110 stay, because they exercise what a mocked repository does not: snapshot metadata (55), parent inheritance (28), rules files, encoding and outputTimestamp (22), ranges (20), BOM imports (14), the change recorder output (7) and profiles (3). The counts overlap. One IT per goal stays as well, so every goal still runs end to end.

An IT is deleted only in the PR that adds a unit test with the same inputs and the same expected result.

Unifying the tests

  • Verify scripts: 121 use try, System.err.println and return false, 117 use assert. The assert form says what failed; the other one prints a message and leaves the invoker to report a generic failure.
  • Unit tests: 34 files on JUnit 4, 22 on JUnit 5; mojos built either through the plugin testing harness or as anonymous subclasses, with 234 setVariableValueToObject calls that bypass parameter binding; no parameterized tests at all.

Found on the way

Pull requests

Activity

  1. added
    maintenance
    on Oct 10, 2026
  2. slachiewicz commented on Oct 11, 2026

    @slachiewicz
    MemberAuthor

    Done: every item is merged, the last one in #1431. The plugin, versions-common and versions-enforcer tests are on JUnit 5 without Hamcrest, and every verify script is written as assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions