Skip to content

Better support for junit5 parameterised tests#687

Merged
baev merged 2 commits into
masterfrom
junit5-params-improvements
Nov 30, 2021
Merged

Better support for junit5 parameterised tests#687
baev merged 2 commits into
masterfrom
junit5-params-improvements

Conversation

@baev
Copy link
Copy Markdown
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