apache / apache/maven-surefire

[SUREFIRE-2222] Use JUnit 5 display name in test reports

Open
#2,692 0 comments 1 reaction 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Alexander Kriegisch](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kriegaex)** opened **[SUREFIRE-2222](https://issues.apache.org/jira/browse/SUREFIRE-2222?redirect=false)** and commented

When running a parametrised JUnit 5 Jupiter test, display names are not used for XML report files and consequently also not in HTML reports.

 

```java
@ParameterizedTest(name = "{0}")
@MethodSource("testParseModernStream_withAnnotationProcessingErrors_args")
void testParseModernStream_withAnnotationProcessingErrors(String jdkAndLocale, String stackTraceHeader) {
// ...
}
```

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:

```xml








```

 
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`.

---

**Affects:** 3.2.2

**Attachments:**
- [image-2023-12-18-13-27-51-220.png](https://issues.apache.org/jira/secure/attachment/13065385/image-2023-12-18-13-27-51-220.png) (_5.24 kB_)

Contributor guide

Open the contributing guide

Research direction

Start with Maven Surefire's JUnit 5 reporting path and compare the XML report output with the parameterized test's display names. Check both XML generation and the HTML output from mvn surefire-report:report or report-only. Done means parameterized cases use their JUnit 5 display names instead of generic method-and-index names in both report formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.