[
https://issues.apache.org/jira/browse/SUREFIRE-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Kriegisch updated SUREFIRE-2222:
------------------------------------------
Description:
When running a parametrised JUnit 5 Jupiter test, display names are not used
for XML report files and consequently also not in HTML reports.
{code:java}
@ParameterizedTest(name = "{0}")
@MethodSource("testParseModernStream_withAnnotationProcessingErrors_args")
void testParseModernStream_withAnnotationProcessingErrors(String jdkAndLocale,
String stackTraceHeader) {
// ...
}
{code}
The method source provides a list of test diaplay names, which e.g. my IDE
recognises and displays correctly:
!image-2023-12-18-13-27-51-220.png!
Surefire, however, does not:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd"
version="3.0" name="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="5.448" tests="21" errors="0" skipped="0" failures="0">
<!- ... -->
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[1]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.12"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[2]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.108"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[3]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.113"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[4]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.098"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[5]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.088"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[6]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.094"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[7]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.083"/>
</testsuite>
{code}
Please note, how the test case names are generic defaults with indices like
{{testParseModernStream_withAnnotationProcessingErrors(String, String)[4]}}.
The same generic names are then reported in HTML reports for {{mvn
surefire-report:report}} or {{mvn surefire-report:report-only}}.
was:
When running a parametrised JUnit 5 Jupiter test, display names are not used
for XML report files and consequently also not in HTML reports.
{code:java}
@ParameterizedTest(name = "{0}")
@MethodSource("testParseModernStream_withAnnotationProcessingErrors_args")
void testParseModernStream_withAnnotationProcessingErrors(String jdkAndLocale,
String stackTraceHeader) {
// ...
}
{code}
The method source provides a list of test diaplay names, which e.g. my IDE
recognises and displays correctly:
!image-2023-12-18-13-27-51-220.png!
Surefire, however, does not:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd"
version="3.0" name="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="5.448" tests="21" errors="0" skipped="0" failures="0">
<!- ... -->
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[1]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.12"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[2]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.108"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[3]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.113"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[4]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.098"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[5]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.088"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[6]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.094"/>
<testcase name="testParseModernStream_withAnnotationProcessingErrors(String,
String)[7]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
time="0.083"/>
</testsuite>
{code}
Please note, how the test case names are generic defaults with indices like
{{testParseModernStream_withAnnotationProcessingErrors(String, String)[4]}}.
> Use JUnit 5 display name in test reports
> ----------------------------------------
>
> Key: SUREFIRE-2222
> URL: https://issues.apache.org/jira/browse/SUREFIRE-2222
> Project: Maven Surefire
> Issue Type: Improvement
> Affects Versions: 3.2.2
> Reporter: Alexander Kriegisch
> Priority: Major
> Attachments: image-2023-12-18-13-27-51-220.png
>
>
> When running a parametrised JUnit 5 Jupiter test, display names are not used
> for XML report files and consequently also not in HTML reports.
>
> {code:java}
> @ParameterizedTest(name = "{0}")
> @MethodSource("testParseModernStream_withAnnotationProcessingErrors_args")
> void testParseModernStream_withAnnotationProcessingErrors(String
> jdkAndLocale, String stackTraceHeader) {
> // ...
> }
> {code}
> The method source provides a list of test diaplay names, which e.g. my IDE
> recognises and displays correctly:
> !image-2023-12-18-13-27-51-220.png!
> Surefire, however, does not:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd"
> version="3.0" name="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="5.448" tests="21" errors="0" skipped="0" failures="0">
> <!- ... -->
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[1]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.12"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[2]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.108"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[3]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.113"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[4]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.098"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[5]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.088"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[6]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.094"/>
> <testcase
> name="testParseModernStream_withAnnotationProcessingErrors(String,
> String)[7]" classname="org.codehaus.plexus.compiler.javac.JavacCompilerTest"
> time="0.083"/>
> </testsuite>
> {code}
>
> Please note, how the test case names are generic defaults with indices like
> {{testParseModernStream_withAnnotationProcessingErrors(String, String)[4]}}.
> The same generic names are then reported in HTML reports for {{mvn
> surefire-report:report}} or {{mvn surefire-report:report-only}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)