@CartesianCsvSource for @CartesianProductTest
See original GitHub issueFollowing #409, it would be nice to have @CartesianCsvSource
which mimics @CsvSource
.
Example:
@CartesianProductTest
@CartesianValueSource(ints = { 1, 2 })
@CartesianCsvSource({
"A, B",
"C, D",
"E, F",
})
void moreParams(int i, String s1, String s2) {
// some test code
}
should generate 6 tests:
Test # | i | s1 | s2 |
---|---|---|---|
1 | 1 | A | B |
2 | 2 | A | B |
3 | 1 | C | D |
4 | 2 | C | D |
5 | 1 | E | F |
6 | 2 | E | F |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Cartesian Product of Parameters
The JUnit 5 (Jupiter) extension @CartesianTest adds a variant of parameterized tests that executes a test for each possible combination of input arguments....
Read more >Introduce ArgumentsProvider that computes the cartesian ...
Introduce ArgumentsProvider that computes the cartesian product ... Different test methods could so easily use different sets of dimensions.
Read more >Cleaner parameterized tests with JUnit 5 - Codeleak.pl
The general idea of parameterized unit tests is to run the same test method for different data. Creating parameterized tests in JUnit 4...
Read more >How to pass multiple parameters to @ValueSource
It lets you specify a single array of literal values and can only be used for providing a single argument per parameterized test...
Read more >CartesianProductTest (junit-pioneer 1.4.1 API) - javadoc.io
@CartesianProductTest is a JUnit Jupiter extension that marks a test to be executed with all possible input combinations.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mizosoft There is a bit of a clash.
When you create a
@ParameterizedTest
, you supply a single (!)@ArgumentsSource
annotation where you define every test case. This is also the reason why annotations annotated with@ArgumentsSource
(e.g.:@CsvSource
or@ValueSource
) are not@Repeatable
.This is different from
@CartesianProductTest
, where you want to define argument sets for each parameter individually and let the extension define the test cases. This is an entirely different approach from@ParameterizedTest
.We cannot support the annotations used by
@ParameterizedTest
because we would need them to be@Repeatable
. They (probably) never will be repeatable because their design philosophy is different from what we need.Can you two take another look at this and come to a decision whether something could be done here given the new approach to Cartesian tests and what that “something” could look like?