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

Support CSV headers in display names in parameterized tests #2767

Closed
wants to merge 1 commit into from

Conversation

sbrannen
Copy link
Member

@sbrannen sbrannen commented Nov 2, 2021

Overview

This PR for #2759 is ready for technical review.

Once the implementation has been approved the remaining documentation Deliverables will be addressed before merging into main and 5.8.x.


Definition of Done

  • There are no TODOs left in the code
  • Method preconditions are checked and documented in the method's Javadoc
  • Coding conventions (e.g. for logging) have been followed
  • Change is covered by automated tests including corner cases, errors, and exception handling
  • Introduce a useHeadersInDisplayName attribute in @CsvSource and @CsvFileSource which enables this feature.
  • When enabled, process the first CSV record as header names and use those names via the Named API to achieve the results in the proposal
  • Update Javadoc
  • Document in User Guide
  • Document in Release Notes
  • All continuous integration builds pass

Given the following parameterized test that sets
useHeadersInDisplayName to true and uses {arguments} instead of
{argumentsWithNames} for its display name pattern...

@ParameterizedTest(name = "[{index}] {arguments}")
@CsvSource(useHeadersInDisplayName = true, textBlock = """
	FRUIT,  RANK
	apple,  1
	banana, 2
	cherry, 3
	""")
void test(String fruit, int rank) {}

The generated display names are:

[1] FRUIT = apple, RANK = 1
[2] FRUIT = banana, RANK = 2
[3] FRUIT = cherry, RANK = 3

See #2759
@sbrannen
Copy link
Member Author

Closed via 450e94a

@sbrannen sbrannen closed this Nov 19, 2021
@sbrannen sbrannen deleted the experiments/display-name-from-csv-headers branch April 23, 2023 13:14
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.

None yet

2 participants