← All install guides

Agent-friendly version of this page: /install/junit5.md

Installing TestGlance for JUnit 5 (Maven / Gradle)

1. Make tests emit JUnit XML

Both build tools emit JUnit XML by default — usually no config change is required.

Maven (Surefire / Failsafe)

maven-surefire-plugin writes XML reports to target/surefire-reports/*.xml. maven-failsafe-plugin (for IT tests) writes to target/failsafe-reports/*.xml.

Copy them under test-results/ so TestGlance auto-discovers them:

# in your CI workflow, after `mvn test`
- name: Collect test reports
  if: always()
  run: |
    mkdir -p test-results
    find . -path '*/surefire-reports/*.xml' -exec cp {} test-results/ \;
    find . -path '*/failsafe-reports/*.xml' -exec cp {} test-results/ \;

Gradle

Gradle writes XML reports to build/test-results/test/*.xml (and a directory per test task). Copy them under test-results/:

- name: Collect test reports
  if: always()
  run: |
    mkdir -p test-results
    find . -path '*/build/test-results/*/*.xml' -exec cp {} test-results/ \;

If useJUnitPlatform() isn't already configured for JUnit 5, add it to the test task in build.gradle:

test {
    useJUnitPlatform()
}

2. Add the TestGlance step to CI

If the project already has a CI workflow that runs the tests, add this step to the test job (after the test step), and merge the permissions: block at the workflow's top level:

permissions:
  contents: read
  pull-requests: write
 
# ...inside the test job, after the test step:
- uses: testglance/action@v1
  if: always()
  with:
    github-token: ${{ github.token }}

If no CI workflow runs the tests yet, create .github/workflows/testglance.yml that runs the project's tests and then runs the TestGlance step.

if: always() matters — TestGlance should still run when tests fail. TestGlance auto-discovers anything matching **/test-results/*.xml, so no report-path is needed when reports land under test-results/.

3. Confirm with the user before committing

Summarize the diff and ask the user to confirm before staging or committing. Do not push.