Skip to content

Named arguments in parameterized tests #2521

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

Merged
merged 11 commits into from
Feb 8, 2021

Conversation

juliette-derancourt
Copy link
Member

@juliette-derancourt juliette-derancourt commented Jan 9, 2021

Overview

Resolves #2301.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@juliette-derancourt juliette-derancourt force-pushed the issues/2301-named-arguments branch from b91a199 to 61a5261 Compare January 11, 2021 12:30
@marcphilipp marcphilipp self-requested a review January 15, 2021 11:10
@juliette-derancourt juliette-derancourt force-pushed the issues/2301-named-arguments branch from 61a5261 to 9528e68 Compare January 15, 2021 21:15
@juliette-derancourt juliette-derancourt marked this pull request as ready for review January 30, 2021 13:58
juliette-derancourt and others added 2 commits February 1, 2021 09:44
Co-authored-by: Marc Philipp <mail@marcphilipp.de>
@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #2521 (ca0f46e) into main (12874e9) will decrease coverage by 0.00%.
The diff coverage is 95.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2521      +/-   ##
============================================
- Coverage     90.53%   90.53%   -0.01%     
- Complexity     4713     4719       +6     
============================================
  Files           413      414       +1     
  Lines         11649    11670      +21     
  Branches        924      924              
============================================
+ Hits          10547    10565      +18     
- Misses          825      826       +1     
- Partials        277      279       +2     
Impacted Files Coverage Δ Complexity Δ
...api/src/main/java/org/junit/jupiter/api/Named.java 75.00% <75.00%> (ø) 1.00 <1.00> (?)
...nit/jupiter/params/ParameterizedTestExtension.java 90.38% <100.00%> (+0.18%) 21.00 <0.00> (ø)
...jupiter/params/ParameterizedTestNameFormatter.java 97.56% <100.00%> (+0.26%) 18.00 <4.00> (+3.00)
...ter/params/ParameterizedTestParameterResolver.java 100.00% <100.00%> (ø) 11.00 <4.00> (+3.00)
...ain/java/org/junit/jupiter/api/AssertionUtils.java 77.41% <0.00%> (-2.59%) 48.00% <0.00%> (-1.00%)
.../main/java/org/junit/jupiter/api/ClassOrderer.java 86.11% <0.00%> (+1.73%) 0.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12874e9...ca0f46e. Read the comment docs.

@juliette-derancourt juliette-derancourt force-pushed the issues/2301-named-arguments branch from cc13a7b to ca0f46e Compare February 1, 2021 10:01
@marcphilipp marcphilipp self-requested a review February 5, 2021 11:26
Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@juliette-derancourt juliette-derancourt merged commit 9c4da09 into main Feb 8, 2021
@marcphilipp marcphilipp deleted the issues/2301-named-arguments branch November 1, 2021 09:00
runningcode pushed a commit to runningcode/junit5 that referenced this pull request Feb 15, 2023
This commit introduces a `Named` interface, which is used to wrap test arguments and give them names.
Thanks to this, arguments in parameterized tests with `@MethodSource` or `@ArgumentSource` can now have optional names. When the argument is included in the display name of an iteration, this name will be used instead of the value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to provide the arguments "name" without actually having it as an argument.
2 participants