Multiple targets are unfortunately not yet supported.
Currently it is a 1:1:1 relationship (test-suite / target / task).
May I ask why you need to separate Vintage and Jupiter tests?
If you really need it, from a cursory look I’d say your second try should work.
You could actually leave out the excludeEngines, just having includeEngines should be enough.
For the curiosity, the tests need to run with IntelliJ platform support. Unfortunately there’s an issue when JUnit 5 tests are run before a JUnit 4. There’s some static shared state I believe that makes all JUnit 4 tests to fail. And having a single unit test code base seemed desirable.
Hence the idea of segregating runs.
My second tentative try didn’t work as expected. And since my team decided to abandon JUnit 5 for the time being I haven’t gave it another shot. That said I believe this ought to be tried for the sake of knowledge.
It’s a bit sad no targets can be created I can well imagine running a code base on a different JDK, or else, in some of my other projects.
Sorry for the delay, I had some mishaps and busy work days. So here’s a simple project with the ideas exposed above (second example). I’ve added you as a contributor, so you won’t have to fork.
I believe there’s 2 issues
Defining the task graph, ideally I would like to have the test task depending on both junit4Test and junit5Test. In the current approach with shouldRunAfter, the junit4Test and junit5Test are not triggered.
The junit4Test and junit5Test do not inherit the configuration performed on the test task, this is performed by the gradle-intellij-plugin. I believe this configuration happens in project.afterEvaluate.
Oh, that’s very unfortunate of course, maybe you should fix that?
It’s not an easy task as it’s a platform issue : IDEA-333958.
ideally I would like to have the test task depending on both junit4Test and junit5Test.
What hinders you to do so?
Besides that it would usually be cleaner make check depend on junit4Test and junit5Test instead of test.
In the current approach with shouldRunAfter, the junit4Test and junit5Test are not triggered.
Of course not, why should they? shouldRunAfter just means that if both tasks are going to run, the one should run after the other, unless they can be run in parallel. mustRunAfter the same, but always.
The junit4Test and junit5Test do not inherit the configuration performed on the test task, this is performed by the gradle-intellij-plugin. I believe this configuration happens in project.afterEvaluate.
Yeah, why should they inherit it?
If it is configuration done on Properties, wire them together if you want.
If not, and the plugin really follows the bad practice to use afterEvaluate, you might need to try to delay an action even further and then copy the eager values that were set there.
Convenience I think, but you’re right check is probably a better candidate to do that.
Of course not, why should they? shouldRunAfter just means that if both tasks are going to run, the one should run after the other, unless they can be run in parallel.
Of course, was looking at the official documentation of JVM test suites and forgot about this. Almost never using shouldRunAfter is not an excuse for not looking at the javadoc.
Yeah that’s precisely the issue (in the case of IntelliJ plugin). Indeed I’m following through Jakub’s changes. Recently he posted updates on test tasks, and we suggested soe JvmTestSuite support.