-
-
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
Introduce JUnit Platform Test Kit #1392
Introduce JUnit Platform Test Kit #1392
Conversation
Pull from head of fork
@sbrannen / @sormuras most of the high level feature work is done, but I am slowly going through the DoD checklist above. Would love some input as to overall direction / guidance to make sure I am in line with what you guys would like. Question though, I am still running into the issue of
Also visible as a build failure here: https://travis-ci.org/junit-team/junit5/jobs/373259220 |
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 build fails because the jar
task of junit-platform-test
is disabled. That's because it's not in mavenizedProjects
in the root build.gradle
. Adding it there causes some other problems that I'll attempt to solve in master
before we merge this PR. For now, manually enabling it in junit-platform-test.gradle
via jar.enabled = true
should suffice.
ExecutionEvent.byTestDescriptor(notNull(predicate, "TestDescriptor Predicate cannot be null")))); | ||
} | ||
|
||
public static class Builder { |
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.
Is any of the Builder
's methods besides addEvent(event)
ever called?
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.
Nope, they aren't, I'll delete for now.
* Represents the entirety of multiple test or container execution runs. | ||
*/ | ||
@API(status = API.Status.EXPERIMENTAL, since = "1.2.0") | ||
public class ExecutionGraph { |
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 fail to see how the list of events represents a graph. Am I missing something? 🤔
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.
Yeah you're right. The intention here originally was to build hierarchy for the resulting Execution
s, but the name was mainly a placeholder for that. I can revert to something like ExecutionsResult
for now, then if I follow up with adding hierarchy later if that's a blocker for me.
private Type type; | ||
private TestDescriptor testDescriptor; | ||
private Object payload; | ||
private LocalDateTime dateTimeOccurred; |
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 Instant
would be more appropriate.
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.
Fair enough, will switch.
@@ -140,7 +140,7 @@ else if (numSegmentsResolved != numSegmentsToResolve) { | |||
List<Segment> unresolved = segments.subList(1, segments.size()); // Remove engine ID | |||
unresolved = unresolved.subList(numSegmentsResolved, unresolved.size()); // Remove resolved segments | |||
return format("Unique ID '%s' could only be partially resolved. " | |||
+ "All resolved segments will be executed; however, the " | |||
+ "All resolved segments will be finished; however, the " |
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.
Did you change this because they might get skipped?
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.
Ah sorry, this might have actually been a find/replace typo. Will revert
In the meantime, I have updated |
Codecov Report
@@ Coverage Diff @@
## master #1392 +/- ##
===========================================
- Coverage 91.91% 91.82% -0.1%
- Complexity 3490 3618 +128
===========================================
Files 321 331 +10
Lines 8329 8567 +238
Branches 722 727 +5
===========================================
+ Hits 7656 7867 +211
- Misses 501 525 +24
- Partials 172 175 +3
Continue to review full report at Codecov.
|
This is ready for another round of CR if anyone has a chance! Appreciate the initial help @marcphilipp |
Side question, should I add details about usage of this to the user guide in this same PR? |
Can you please check why generating Javadoc fails? You can run
Ultimately, yes. But let us review first, so you won't have to rework the documentation should we see the need for additional changes. |
Should be all set now with the fix, let me know if I should make further revisions. I am really excited to give back to the junit5 codebase, it's been a true pleasure working with it. |
@sormuras / @marcphilipp does anyone have some bandwidth to help CR this and push it through? Thanks! |
Any updates on getting this through? |
I'll test-drive and review this PR next week. |
This branch is 18 commits ahead, 56 commits behind junit-team:master. Can you please rebase onto current |
Should be all good to go for when you review. I will document usage in this PR if the current implementation looks good :) |
Thanks for restoring the ✔️
|
It's green again! 🙂 In general, I'd like to see more "package-only" refactorings. Like only replacing For example import org.junit.platform.engine.test.TestDescriptorStub; turning into import org.junit.platform.testkit.TestDescriptorStub; Changing a class name here and there, like you did with Can you tell me more about why you replaced "number of tests started" with "number of tests finished"? Coming from assertEquals(1, eventRecorder.getTestStartedCount(), "# tests started"); and reading now assertEquals(1, executionsResult.getExecutionsFinished().size(), "# tests started"); doesn't seem consistent for me. I expected to read: assertEquals(1, executionsResult.getTestStartedCount(), "# tests started"); |
Thanks for the CR, that all makes sense and apologies for combining a few steps in one here. Most of the refactorings of class names stemmed from having something short and memorable. I replaced With that said, do you think it would be better to replace the call with Or I could just rename |
Or rather, it might be better if I switch any I just wanted it to be clearly distinct from I mainly removed the Thanks again for the feedback :) |
I swear it was green a couple days ago 😢 I will take another look at it and see what the problem is. I might rebase off of |
Hi @dotCipher, Thanks for getting things cleaned up. Since we just released 5.3 RC1 last night, this has been pushed to 5.4 M1. Thus, we won't be merging it until after 5.3 GA has been released, and we may not get a chance to review it until then either. Just FYI... |
Ok, that makes sense, I'll stay tuned until then. |
@dotCipher Now that 5.3 and 5.3.1 have been released, could you please rebase your branch on master? |
Sure thing, I'll have up-to-date by EoD Monday (Sept 17th). Thanks! |
Looking forward to it. 👍 |
fc41f0a
to
1f469ce
Compare
Green build and up-to-date now, let me know if I should start on the User Guide / Release Notes. 👍 |
Green is always good! ✔️ My plan is to merge this into |
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.
Found one minor nit: please replace all 1.3.0
versions with 1.4.0
And a major one: the junit-platform-testkit
is intended to be used in test
scope. Thus all types of its API must reside under src/main/java
.
@@ -10,7 +10,8 @@ dependencies { | |||
testImplementation(project(':junit-jupiter-api')) | |||
testImplementation(project(':junit-platform-runner')) | |||
testImplementation(project(path: ':junit-jupiter-engine', configuration: 'testArtifacts')) | |||
testImplementation(project(path: ':junit-platform-engine', configuration: 'testArtifacts')) | |||
testImplementation(project(':junit-platform-testkit')) | |||
testImplementation(project(path: ':junit-platform-testkit', configuration: 'testArtifacts')) |
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.
Mh, I'd prefer to have all types of the Platform TestKit in src/man/java
. Thus rendering this extra configuration not needed.
Please move all types from https://github.com/dotCipher/junit5/tree/feature/junit-platform-testing/junit-platform-testkit/src/test/java/org/junit/platform/testkit to https://github.com/dotCipher/junit5/tree/feature/junit-platform-testing/junit-platform-testkit/src/main/java/org/junit/platform/testkit -- in short, from test
to main
. Unless a type is a unit test for a testkit class.
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.
What to do with ExecutionEventConditions
and TestExecutionResultConditions
and their dependency on AssertJ?
Not sure, yet. Perhaps leave them under src/test/java
for now...
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.
...or let users of the JUnit Platform TestKit transitively depend on AssertJ. Would be fine with me.
What do you think, @junit-team/junit-lambda ?
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 that's ok in this case.
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.
Ok, so to be clear, I will move everything under test
to main
, including ExecutionEventConditions
and TestExecutionResultConditions
.
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.
Aye.
Hello! I'm currently working on several extensions (@DefaultLocale and @DefaultTimeZone and @Testcontainers) and I've thought about how an API for the testkit could look like. I have implemented a proposal for an API that is based on annotations, rather than inheritance. Furthermore it just exposes the functionality to users that is relevant to them. I'd like to invite everybody to discuss my proposal and maybe we can combine some of the stuff that has already implemented here and some of the things I'm proposing to get the best out of the testkit :-) |
Team Decision: Merge this PR. Then it can be refactored and improved to support common use-cases. |
Thanks for all the work on this, @dotCipher 👍 |
Overview
Addresses issue #1356 by building an
ExecutionRecorder
that returns anExecutionsResult
from the platform run based on a providedTestEngine
. This should allow us to ask both micro and macro questions against theExecutionsResult
for answering questions like:Replaces #1380
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations