-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[WIP] Add tag and test source support to dynamic containers and tests #1396
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1396 +/- ##
============================================
- Coverage 92.05% 91.84% -0.22%
- Complexity 3257 3259 +2
============================================
Files 301 301
Lines 7846 7868 +22
Branches 662 663 +1
============================================
+ Hits 7223 7226 +3
- Misses 453 473 +20
+ Partials 170 169 -1
Continue to review full report at Codecov.
|
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.
While I understand the use case for specifying a TestSource
, I'm not sure how adding tags would be useful. The main use case for tags is to the tests that should be executed. However, we only apply those filters to static TestDescriptors
at the moment.
UniqueId uniqueId; | ||
Supplier<JupiterTestDescriptor> descriptorCreator; | ||
TestSource source = node.getTestSource().orElse(testSource); | ||
Set<TestTag> tags = node.getTags().stream().map(TestTag::create).collect(Collectors.toSet()); |
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.
We need some exception handling here because TestTag::new
might throw an exception.
@@ -113,4 +116,16 @@ public Executable getExecutable() { | |||
return this.executable; | |||
} | |||
|
|||
public DynamicTest withTags(String... tags) { | |||
DynamicTest result = new DynamicTest(getDisplayName(), executable); | |||
result.tags = new HashSet<>(Arrays.asList(tags)); |
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.
I think calling withTags()
multiple times should add the tags instead of overwriting the existing ones.
@@ -2,7 +2,8 @@ description = 'JUnit Jupiter API' | |||
|
|||
dependencies { | |||
api("org.opentest4j:opentest4j:${ota4jVersion}") | |||
api(project(":junit-platform-commons")) | |||
api(project(':junit-platform-commons')) | |||
compileOnly(project(':junit-platform-engine')) |
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.
If we all agree to go this route, we should make sure junit-platform-engine
is listed as optional
in the generated POM.
@marcphilipp - We discussed the theoretical use case* for tags from DynamicTests in #1178. Of course, that all relies on them being honored for test filtering/running/skipping. If that doesn't work due to where DynamicTests are created in the lifecycle, then I agree that they're not particularly useful. * - Basically, allows a lot of benefit of a new TestEngine with less work in implementation. |
Superseded by #1428 |
Overview
Addresses #1178
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations