question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Investigate parameter targeting of CartesianProductTest arguments source annotations

See original GitHub issue

A very strong argument can be made that it’s much more convenient to define a CartesianProductTest like the following:

@CartesianProductTest
void test(
    @CartesianValueSource(strings = { "A", "B", "C" }) String str,
    @CartesianEnumSource(ChronoUnit.class) ChronoUnit unit
) {
    // some passing test code here
}

Investigate if this is possible - it is likely it is not possible, because of how the annotations invoke their corresponding ArgumentsProvider implementations, but it might work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Michael1993commented, Feb 8, 2021

The main reason I opened this issue is because this is a frequently asked question. I would like to have a discussion/discovery about this, so I can link to it as an explanation, i.e.: “This is not possible, we investigated this in #415” or “While this is possible, the team came to a decision to not support it - see discussion on #415” or we might just decide to support it but discourage users from using it, etc.

ETA: “frequently” as in 2 people have asked this so far.

1reaction
Bukamacommented, Jun 20, 2021

I like the Long and the Nested names, cause they are clearly associated with the CartesainProduct-Extection From those two the Long are somehow clumsy, so I would like to go with the Nested

Read more comments on GitHub >

github_iconTop Results From Across the Web

Non-adjacent repeatable annotations do not work ... - GitHub
While working on #414, I realized there is a nasty issue when repeatable annotations have other annotations (repeatable or not) in between.
Read more >
Cartesian Product of Parameters - JUnit Pioneer
You can annotate the test parameters directly with @CartesianTest.Values , @CartesianTest.Enum , or range source annotations (see Defining arguments on ...
Read more >
CartesianProductTest (junit-pioneer 1.4.1 API) - javadoc.io
This annotation is somewhat similar to @ParameterizedTest , as in it also takes arguments and can run the same test multiple times.
Read more >
JUnit 5 - Parameterized Tests - nipafx.dev
This means, by annotating a parameter with either @ConvertWith or your custom annotation, JUnit Jupiter passes whatever argument a source ...
Read more >
Guide to JUnit 5 Parameterized Tests - Baeldung
This source takes one array entry each time, splits it by comma and passes each array to the annotated test method as separate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found