-
-
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-suite-api module #681
Comments
@smoyer64 I have the impression that if we did #691, migrating to the java library plugin, it would solve the implicit dependencies problems that you are mentioning. I suspect the junit dependency of the junit-platform-runner project would be an implementation dependency. Even if the dep problem would be solved by #691, introducing a new project might still be valuable as it could it could clearly denote what the API is for building engines. |
I think it has to be an |
This is something I've been wanting to do ever since we introduced the suite support for JUnit 4 on the platform. I recommend moving the annotations to a module named And I'm slating this for inclusion before 5.0 GA so that the change is less disruptive for consumers of the API. |
The proposed |
Actually, I'd like to move the annotations in M4: the earlier, the better. @junit-team/junit-lambda any objections? |
Sure. Go ahead! |
There are, however, some issues with this approach... Since the suite annotations are open for use by anyone (i.e., any With the Vintage engine, it's straightforward since Should the JUnit Platform itself actually honor the suite annotations instead of test engines taking over that job? For example, those annotations actually have a one-to-one correlation to selectors and filters already supported by the launcher APIs. So, the launcher could perhaps automatically detect those annotations and modify the request dynamically, before passing the request to any registered test engines. Has anyone put any thought into these types of issues? |
@smoyer64, I just noticed your proposed |
@sbrannen I've already got the If you're saying this feature will be added into JUnit 5 itself, it seems that I should probably stop now - or at least coordinate adding this feature into the JUnit 5 codebase instead? If you look at #687 you'll also find that this function could be accomplished as an |
@smoyer64, I honestly have not put a great deal of thought into this topic (at least not on the implementation level). IMHO, the JUnit Platform would ideally provide support for declarative suites (e.g., configured via annotations) regardless of which test engines are registered. That's about all I can contribute at the moment in terms of a vision. Sooooo, my goal would be to make that vision become reality. But... I have yet to determine the feasibility of such a vision. |
in progress |
@smoyer64, would you mind opening a new issue to address the |
Prior to this commit, annotations such as @SelectPackages, @ExcludeTags, etc. were part of the junit-platform-runner module. This unnecessarily tied these annotations to JUnit 4 even though these annotations can theoretically be used by any engine or tool wishing to allow users to configure test suites declaratively. This commit addresses this issue by moving all such 'suite' annotations from the `org.junit.platform.runner` package to the `org.junit.platform.suite.api` package in a new `junit-platform-suite-api` module. Issue: #681
Addressed in 248943f. |
I'd be happy to open another issue to (help) specify the declarative suite behavior and I'm more than happy to see it end up in the JUnit 5 itself. Assuming the suite's execution could hook into JUnit 5 in a non-public way, I'll leave it neutral with respect to #687 but that may still have some benefits. This also seems like it's going to supercede junit-pioneer/junit-pioneer#35. |
Thanks, @smoyer64. Please let me know once you're created the new issue (in case I miss it). |
Test suites are broken, changes coming in 5.5/5.6, see junit-team/junit5#681. Plan to have sibling projects for BigInt implementations, can then perhaps avoid use of suites.
Overview
Move the following Java types to a new
junit-platform-suite-api
module. These types will be useful to many engine developers and, other than the references to@RunWith(JUnitPlatform.class)
in the javadocs, should not be tied to the vintageRunner
.Feature request
I've extended the
JupiterTestEngine
to create theJupiterSuiteEngine
which supports an arbitrary hierarchy of test containers between the engine and test classes. At each level of the suite hierarchy,@BeforeSuite
and@AfterSuite
are supported, so you can also nest the hierarchy ofsetUp
andtearDown
. An example suite looks something like this:The
JupiterSuiteEngine
is currently hard-coded to scan for classes that end with "Suite" but it's my intention to have the engine consider the class name patterns and selections passed into the engine (once I make sure there won't be collisions with theJupiterTestEngine
. You can obviously have more than one suite discovered by the engine in which case they will be peers in the test hierarchy.In any case, when importing
junit-platform-runner
into my project, I also get the actual JUnit 4Runner
classes which I don't need. Worse yet, this implicit dependencies to my project which I don't need. My current work-around is to exclude these classes from the dependency graph as follows:This obviously isn't the cleanest way to manage dependencies and it's my belief that the types listed above will be useful to many engine developers. As an aside, providing maintained interfaces to the
utils/*Utils
classes injunit-platform-commons
will also help this project tremendouslyDeliverables
junit-platform-runner
tojunit-platform-suite-api
.The text was updated successfully, but these errors were encountered: