@CartesianProductTest extension
See original GitHub issueOverview
Provide a similar, but complete and fleshed-out, extension that provides a @CartesianProductTest
annotation implemention.
Usage outline
@CartesianProductTest({"0", "1"})
void threeBits(String a, String b, String c) {
int value = Integer.parseUnsignedInt(a + b + c, 2);
assertTrue((0b000 <= value) && (value <= 0b111));
}
@CartesianProductTest
@DisplayName("S ⨯ T ⨯ U")
void nFold(String string, Class<?> type, TimeUnit unit, TestInfo info) {
assertTrue(string.endsWith("a"));
assertTrue(type.isInterface());
assertTrue(unit.name().endsWith("S"));
assertTrue(info.getTags().isEmpty());
}
static CartesianProductTest.Sets nFold() {
return new CartesianProductTest.Sets()
.add("Alpha", "Omega")
.add(Runnable.class, Comparable.class, TestInfo.class)
.add(TimeUnit.DAYS, TimeUnit.HOURS);
}
Implementation idea
Todos
- Copy sources from
junit5-jupiter-extensions
and adopt to pioneers’ (package) structure. - Write unit and integration tests for the
@CartesianProductTest
and its provider. - Support more basic types in the annotation, in addition to
String
? - Document usage and limitations
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Cartesian Product of Parameters [removed in 2.0]
The JUnit 5 (Jupiter) extension @CartesianProductTest adds a variant of parameterized tests that executes a test for each possible combination of input ...
Read more >junit-team/junit5 - Gitter
@jahluwalia Are you looking for something like @CartesianProductTest ? ... jupiter-extensions/src/test/java/com/example/cartesian/CartesianProductTests.java.
Read more >Parameterize both class and tests in JUnit 5 - Stack Overflow
JUnit Pioneer. There is the JUnit Pioneer extension pack for JUnit Jupiter. It comes with @CartesianProductTest . Using the extended the example ...
Read more >JUnit Pioneer 1.0 - nipafx.dev
There you go, all ten Jupiter extensions in just three tests ... The @CartesianProductTest annotation lets you specify values for each ...
Read more >JUnit Pioneer - SlideShare
JUnit Pioneer is an extension library for JUnit 5 (Jupiter). ... product of all inputs Use @CartesianProductTest instead of Jupiter @Test ...
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
Ideally the
@CartesianProductTest
would be able to reuse any existing argument source, including the@RangeSource
described in #123. For example:I like the idea of tagging the parameters. If an issue is open on that topic, please share its link here.