-
Notifications
You must be signed in to change notification settings - Fork 71
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
CartesianProductTestExtension from JUnit examples #321
CartesianProductTestExtension from JUnit examples #321
Conversation
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Things to consider:
|
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
…mentation Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My request changes are mostly about docs. The rest are more questions.
src/test/java/org/junitpioneer/jupiter/CartesianProductTestExtensionTests.java
Show resolved
Hide resolved
src/test/java/org/junitpioneer/jupiter/CartesianProductTestExtensionTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/junitpioneer/jupiter/CartesianProductTestExtensionTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/junitpioneer/jupiter/CartesianProductTestExtensionTests.java
Show resolved
Hide resolved
src/test/java/org/junitpioneer/jupiter/CartesianProductTestExtensionTests.java
Show resolved
Hide resolved
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
I just briefly skimmed over the PR, really like that feature. Personally, I already needed the Cartesian product several times in the past. Kudos @Michael1993! I have only one question: When it comes to supplying test parameters, I just wonder if it would be helpful to stick to the style of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some smaller things in the docs I obviusly missed on the first turn. Sorry for that. After that it's okay for me.
src/main/java/org/junitpioneer/jupiter/CartesianProductTest.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public boolean supportsTestTemplate(ExtensionContext context) { | ||
return findAnnotation(context.getTestMethod(), CartesianProductTest.class).isPresent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you argue to throw Pioneer Annotations out, because we can use the JUnit things. The idea was Pioneer Annotation was to encapsulate the JUnit thing with our own, improved methods. But I'll leave it to you / the others which way we use.
Same for TestKit or PioneerAssertions 🤷♂️
@beatngu13 There is a bit of a clash. When you create a This is different from We cannot support the annotations used by We can create our own annotation(s), (e.g.: |
…to `CartesianProductTest` Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
@Michael1993 ah, I see. Thanks a lot for that detailed explanation! I think this is important:
So, However, the PR is already great, @Bukama likes it and since we are pioneers … 😉 Let's see what @nicolaiparlog thinks. |
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
Signed-off-by: Mihaly Verhas <misi.verhas@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few details...
* {@code @CartesianProductTest} is a JUnit Jupiter extension that marks | ||
* a test to be executed with all possible input combinations. | ||
* | ||
* <p>Methods annotated with this annotation should not be annotated with {@code Test}. | ||
* </p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a little more detail on how to use the extension and a link to the website with details?
|
||
@Override | ||
public boolean supportsTestTemplate(ExtensionContext context) { | ||
return findAnnotation(context.getTestMethod(), CartesianProductTest.class).isPresent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of our annotation methods is that they make it easy to find meta annotations that are _indirectly present: (if a supertype of the element is annotated), meta-present (if an annotation that is present on the element is itself annotated), or _enclosing-present (if an enclosing type [think opposite of @Nested
] is annotated). As I see it, only meta-present is relevant here, but that should indeed be allowed. Not sure if AnnotationSupport.findAnnotation
does that.
src/main/java/org/junitpioneer/jupiter/CartesianProductTestExtension.java
Outdated
Show resolved
Hide resolved
src/main/java/org/junitpioneer/jupiter/CartesianProductTestNameFormatter.java
Show resolved
Hide resolved
From the documentation of
It should be enough to use here. |
….com/Michael1993/junit-pioneer into issue/68-cartesian-product-extension
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
Opened to let us move forward with #68
PR checklist
The following checklist shall help the PR's author, the reviewers and maintainers to ensure the quality of this project.
It is based on our contributors guidelines, especially the "writing code" section.
It shall help to check for completion of the listed points.
If a point does not apply to the given PR's changes, the corresponding entry can be simply marked as done.
Documentation (general)
.adoc
file in thedocs
folder, e.g.docs/report-entries.adoc
.adoc
files)Documentation (new extension)
docs/docs-nav.yml
navigation has an entry for the new extensionpackage-info.java
contains information about the new extensionCode
Contributing
README.md
mentions the new contribution (real name optional)I hereby agree to the terms of the JUnit Pioneer Contributor License Agreement.