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
Publish a module that combines the Jupiter API, Params, and Engine in one artifact #1629
Comments
A POM file that merges two artifacts, API and Params, seems like an overkill to me. Analog to JUnit 4's <dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies> If you want to use <dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Both minimal POM file snippets require the underlying build tool auto-resolves the |
I can certainly disagree with that. I'd prefer we'd not discuss build system shortcomings and whatever was done here to make it easier in one vs. the other. IMO, all that matters is the users community at large and a somewhat consistency with JUnit 4. It feels to me the modularity and architecture of JUnit Jupiter puts the onus on the user for the most basic task of configuring a project. Yes, one part is the API and only required to write tests while the other is a mandatory component that is only required at runtime to run your tests. Does a regular user care? If you do, then the work that was done as part of JUnit Jupiter is great because it gives you the flexibility to define the right semantic in your build. If you don't, or if you're happy with the status quo that JUnit 4 provides, why should we insist here on telling users they have to do it this way? I'd welcome some adaptations to make the transition to Junit Jupiter as smooth as possible, even if that means making some compromise in what you feel is the right way to configure a project. |
I guess not. That's why a regular user should only depend on This is not complex.
If you're happy with X, stay with X. X includes JUnit 3, 4, TestNG, and even
We shouldn't do this at all. We may provide options. Present each option in its minimal, understandable, easy-to-learn (maybe hard-to-master) way. JUnit 5 modularity is its unique feature. Actually, there is no JUnit 5 in the sense there was a single JUnit 4 artifact -- why pretend it exists? IMO, having too much transition magic/helpers only obscures reality and hinders users to really learn about the new choice. With The best helper is: https://junit.org/junit5/docs/current/user-guide ;-) |
I'm not sure it's even fair to compare the JUnit 5 Parameterized tests to those built into JUnit 4 - the functionality really isn't in the same league. In 99% of my past projects, I ended up importing both JUnit 4 and JUnitParams. I do feel the pain of transitioning to JUnit 5 when trying to explain how to configure Surefire and which engine it will pick. This, IMHO, is improving and part of that pain has been staying on the bleeding edge. When the tool-chains all include one of twenty compatible (with my test class) engine version, I think this should go away. |
I did notice that, but I wondered if the distinction made much difference to most users. Is the additional dependency worth it?
Is the I'm asking because at some point we're planning to upgrade Spring Boot's testing support to use JUnit 5 and I'd like to make sure we use the recommended configuration.
Thanks, that makes things clearer. So depending on
Understood, perhaps at some point it will get promoted into the core module. Until then, two dependencies makes sense. BTW, I think some additional documentation or links early in the reference guide might really help with the getting started experience. A couple of "quick start" examples for Maven and Gradle in the installation section would probably help 90% of your users get going quickly. I didn't find the "Running Tests" section until a bit later so I was mainly going on the samples as my guide for how to configure the build system. |
In hindsight it feels like a single dependency isn't worth it. I misunderstood the role of the engine jar and it's clear that there's a desire for |
@philwebb There are also now JUnit 5 pages for both the Surefire and Failsafe plugins (e.g. https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html). |
At the moment it is just an option, when running on Java 11 and above. It is my playground to investigate "Testing In The Modular World", especially when it comes to white box testing on the module-path. With those specific requirements, it won't be the recommended way to configure Maven. Perhaps, some day in near future, when 90% of all Java projects are on Java 11+. ;-)
Although I'm actively helping out to keep Surefire feature-wise up to date, I'm not sure if all features of the
True. This feature is planned to be included in
Yeah. A link to the section below and a link to the junit5-samples would improve the situation. |
I think that's a good idea, @philwebb! We already have links to the junit5-samples repository, but we could certainly rework the initial content of the User Guide.
When you say "samples" in this context, do you mean the examples inlined within the User Guide or the aforementioned |
Team Decision: Publish an experimental |
Thanks for the feedback. Can it be a (FTR, Spring Boot starters are addressing a similar feature and they are jars for that reason). |
Mh, Gradle seems to "understand" that and resolves transitive dependencies. Maven needs that extra line... so yes, considering to publish almost empty jar files. They might contain compiled module descriptors ( |
The "implementation" part is done in #1691 -- updating the initial documentation and release notes is next. |
Introduce 'junit-jupiter' as an almost empty aggregator module easing the configuration required to get started with JUnit Jupiter. Addresses #1629
Introduce 'junit-jupiter' as an almost empty aggregator module easing the configuration required to get started with JUnit Jupiter. Addresses #1629
@philwebb |
Example in user's POM:
|
We do already offer a junit-bom here: https://search.maven.org/search?q=a:junit-bom We decided to offer an "empty jar" because of @snicoll request:
|
@sormuras |
Hmm...
Well, I suppose one argument in favour of having a JAR as well as a BOM is that it allows more Gradle users to use this aggregation feature (since importing BOMs in Gradle isn't a built-in feature in earlier versions of Gradle, IIRC), and a second argument would be that it gets rid of the verbosity of importing all of |
I am not sure you can call that a Maven standard, right? I understand what you mean but the |
Hello - If I have only this dependency:
Then my dependency tree looks like this, which seems sensible:
But if I use the
Then my dependency tree looks like the following, where transitive dependencies are suddenly
Is it expected that the scope of transitive dependencies is different when the |
Upon further examination, it appears that this behavior is happening pulling in anything using It looks like everything in the 5.4.0-M1 bom has an explicit |
@eggilbert Do you mind opening a new issue for the side-effect between BOM and the |
Yes, I believe that is in fact the culprit. The BOM should not define any scope for managed dependencies. @eggilbert, would you mind opening a new issue for that? @sormuras, my requested issue would supersede your request -- right? |
On second thought, I'll go ahead and create raise a bug report against 5.4 M2 so that we don't forget about it. |
FYI: I opened #1712. |
@sbrannen thanks! |
Overview
It's fairly common to require
junit-jupiter-api
,junit-jupiter-params
andjunit-jupiter-engine
when writing tests. Currently this means that any build file need three distinct imports, and possible a version property declaration to ensure version compatibility.The currently Maven and Gradle samples themselves show such a setup.
It would really help the getting started experience if a single
junit-jupiter
dependencies was available that pulled in the others transitively. The would change a Maven build from this:to this
Deliverables
The text was updated successfully, but these errors were encountered: