Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUREFIRE-2101] - Fixes 'null' phrased test names with JUnit5 without @DisplayName #549

Merged
merged 1 commit into from
Dec 27, 2022

Conversation

ascopes
Copy link
Contributor

@ascopes ascopes commented Jun 19, 2022

When phrased test names are enabled, but an annotation such as DisplayName
in JUnit5 is missing from the test, the output to the console will now
fall back to using the original name rather than naming the test
'null'.

This amends this behaviour to provide a more meaningful name in these scenarios,
which can be important when migrating a large code base over to using
phrased names incrementally.

An example of the existing output which can be problematic:

image


To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

When phrased test names are enabled, but an annotation such as DisplayName
in JUnit5 is missing from the test, the output to the console will now
fall back to using the original name rather than naming the test
'null'.
@andpab
Copy link
Contributor

andpab commented Dec 22, 2022

This pull request fixes the issue for the JUnit5StatelessTestsetInfoReporter, but not for the JUnit5ConsoleOutputReporter.

You can see that in the output of the JUnitPlatformEnginesIT#testJupiterEngineWithDisplayNames. It still has "Running null" in it with your fix.

The reason it doesn't work there is that you adjusted the behaviour for the CategorizedReportEntry and the WrappedReportEntry, but not for the SimpleReportEntry.

I've made an alternative pull request #587 that fixes it in a single place, the TestSetStats class. I think that's more robust.

@slawekjaranowski slawekjaranowski merged commit 61f03c6 into apache:master Dec 27, 2022
@slawekjaranowski
Copy link
Member

@ascopes thanks
I changed commit message to contains issue number in square brackets 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants