Core support for JUnit Platform a.k.a. "JUnit 5"

The JUnit team currently maintains their own Gradle plugin to run tests using the new JUnit Platform a.k.a “JUnit 5”. This plugin is very simple and has many limitations, e.g. it does not use the test task.

The plugin was meant as a proof-of-concept, not a long-term solution. Instead, we would like to start the discussion about how to get JUnit 5 support into core Gradle. Etienne Studer has asked us, the JUnit team, to ask for advice how to go about this here. So, please advise us! :slight_smile:

2 Likes

Hello Marc,

My sincerest apologies for our not answering you sooner.

Thank you for being a valuable part of Gradle. We are discussing the best way to help Gradle users use JUnit 5 (should we create an official plugin or include in core or something else).

You should expect an answer from us early next week.

Cheers,
Eric

Hi again Marc,

We would love to include JUnit Platform support in Gradle core.

All of the JVM testing functionality is encapsulated in the testing-jvm module, so that’s where we should focus our efforts. In particular, working with or refactoring the Test task may be interesting.

It seems that JUnit Platform only supports Java 8 and higher. We will need to keep in mind that Gradle 3.x still supports Java 7. That’s ok, we fork a new JVM for tests and can enforce Java8+ semantics at runtime. That just means that we cannot introduce compile-time dependencies to Gradle that don’t compile on Java 7.

Typically, we go through a design phase for new features in Gradle Core. I’ve had a look at your plugin, and it doesn’t look like too much code. Still, I think it would be prudent to produce minimal design doc for this in order to ensure our design can scale to future upgrades in Gradle and the JUnit Platform. More on that in a moment.

I am happy to guide you through this process. In my mind, the best way to get started is:

How does that sound? If that’s acceptable, is there anything else I can provide to help with Step 1?

Cheers,
Eric

Hi Eric,

sorry for my delayed response. We currently have very little time to work on the project given that 3/4 of the team was quite (re)productive this year.

For the first item: Is there documentation on the “testing framework” abstraction that already exists in Gradle?

Thanks,
Marc

1 Like

Ha ha… congrats to all :slight_smile:

As far as existing docs go, the Test DSL and Test API may be of some help. I’m afraid I don’t know about any other design documentation around it, unfortunately.

I have gained a little extra help recently and we would really like to support JUnit Platform in a near-term release. Given your position also, I think we (Gradle) should help more with the design aspect than I indicated in my earlier communication. That said, we are booked for Gradle 3.3. Would it make the more sense for us to pick this up starting in Gradle 3.4 development (mid-December 2016) or would you like to continue on the current trajectory and see where we get?

Cheers,
Eric

1 Like

Sounds great! Just ping us in December. :thumbsup:

I’m assuming you guys are still booked to finish 3.3, right?

Hi Marc,

I expect we’ll be booked for the next week or so. Meanwhile, you may want to review Andrew Oberstar’s draft design spec for JUnit Platform support.

Any other information from your side you think we should be aware of?

Cheers,
Eric

Hi Eric,

the draft design spec looks good! In addition to Javadoc, there’s a section in the User Guide that covers the Launcher API and extensibility via custom TestEngine implementations. Let us know if you have any questions! I’m also available in early January if you want to discuss open questions.

Thanks,
Marc

Hi Marc,

Thanks for your initial design review. I have filed gradle/gradle#1037 for us to review and polish the design doc. I expect it’ll be prioritized for work at the end of this week or next week.

We’ll definitely reach out to you directly if we need guidance.

Cheers,
Eric

Sounds good, thanks!