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

Better support for junit5 parameterised tests #687

Merged
merged 2 commits into from
Nov 30, 2021

Conversation

baev
Copy link
Member

@baev baev commented Nov 29, 2021

Context

Allure now detects junit test templates. For test templates test result name is set to concatenation of template's display name and invocation's display name. For example, the following test:

@ParameterizedTest
@ValueSource(strings = {"some value"})
void test(ArgumentType argumentValue) {...}

will be displayed as test(ArgumentType) [1] argumentValue=some value in the report.

This also allows usage of @DisplayName together with @ParameterizedTest (fixes #500):

@DisplayName("My named test")
@ParameterizedTest
@ValueSource(strings = {"some value"})
void test(ArgumentType argumentValue) {...}

will be displayed as My named test [1] argumentValue=some value in the report.

Besides that, all the parameters will be displayed correctly as well. Including support for new @Param annotation:

@ParameterizedTest
@ValueSource(strings = {"some value"})
void test(@Param("some parameter name") ArgumentType argumentValue) {...}

Checklist

@baev baev added the type:improvement Change that improves some user experience but can't be considered as a new feature label Nov 29, 2021
@github-actions github-actions bot added the theme:junit-platform JUnit 5 related issue label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:build theme:junit-platform JUnit 5 related issue type:improvement Change that improves some user experience but can't be considered as a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[junit5] DisplayNameGenerator is ignored for class name
2 participants