Skip to content

Legacy XML reports generated for @ParameterizedClass tests do not contain parameters #5409

@amilbourne

Description

@amilbourne

This issue stems from #5296 which was closed because the report in question was being generated by Gradle, but the same issue exists in JUnit 6.0.3.

If you have a test using @ParameterizedClass and get it to generate legacy reports, the parameters do not appear in the report and you just get lots of duplicate entries for each method. This makes it hard to tell which parameters failed and hard for other tools to process the report.

Steps to reproduce

I used the junit-platform-console-standalone-6.0.3.jar to run the test from the command-line

The test was:

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.Locale;

import static org.junit.jupiter.api.Assertions.*;

@ParameterizedClass(name="candidate={0}")
@ValueSource(strings = { "first", "second", "third" })
class ClassParamTest {

  private String candidate;

  public ClassParamTest(String candidate) {
    this.candidate = candidate;
  }

  @Test
  void notEmpty() {
    assertFalse(candidate.isEmpty());
  }

  @Test
  void isLowercase() {
    assertEquals(candidate.toLowerCase(Locale.ROOT), candidate);
  }
}

The build script was:

#!/bin/bash
cd ~/code/junit-test
JAR=junit-platform-console-standalone-6.0.3.jar
if [ ! -f "$JAR" ]; then
  curl -fL -o "$JAR" "https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/6.0.3/$JAR"
fi
mkdir -p out/test-classes reports
javac -cp "$JAR" -d out/test-classes test/ClassParamTest.java
java -cp "$JAR:out/test-classes" -jar "$JAR" execute -cp out/test-classes --reports-dir=reports --config=junit.platform.reporting.output.dir=reports --config=junit.platform.reporting.legacy.xml.enabled=true --scan-class-path

and the report generated was:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="JUnit Jupiter" tests="6" skipped="0" failures="0" errors="0" time="0.061" hostname="co1devps22.yb.lmax" timestamp="2026-02-26T17:39:08">
<properties>
<property name="file.encoding" value="UTF-8"/>
</properties>
<testcase name="isLowercase()" classname="ClassParamTest" time="0">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#2]/[method:isLowercase()]
display-name: isLowercase()
]]></system-out>
</testcase>
<testcase name="isLowercase()" classname="ClassParamTest" time="0">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#3]/[method:isLowercase()]
display-name: isLowercase()
]]></system-out>
</testcase>
<testcase name="notEmpty()" classname="ClassParamTest" time="0">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#3]/[method:notEmpty()]
display-name: notEmpty()
]]></system-out>
</testcase>
<testcase name="notEmpty()" classname="ClassParamTest" time="0">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#2]/[method:notEmpty()]
display-name: notEmpty()
]]></system-out>
</testcase>
<testcase name="notEmpty()" classname="ClassParamTest" time="0">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#1]/[method:notEmpty()]
display-name: notEmpty()
]]></system-out>
</testcase>
<testcase name="isLowercase()" classname="ClassParamTest" time="0.013">
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]/[class-template:ClassParamTest]/[class-template-invocation:#1]/[method:isLowercase()]
display-name: isLowercase()
]]></system-out>
</testcase>
<system-out><![CDATA[
unique-id: [engine:junit-jupiter]
display-name: JUnit Jupiter
]]></system-out>
</testsuite>

Note that I removed most of the properties as they are not really relevant

I would expect the test names to be something like:

<testcase name="isLowerCase[first]" classname="ClassParamTest" time="0.019"/>

Context

  • Uses Jupiter 6.0.3

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions