Running select tests in forked JVMs

Is there a way to run just select unit tests in forked JVMs?

There is currently a Mockito Bug (#2183) exposed when mocking enums. A workaround is to run the select tests in separate forks.

This comment explains how to implement the workaround using Maven’s Surefire plugin. Hoping there’s a clean Gradle solution.

I think you can do the same with Gradle.
Register a second test task that includes the tests in question by some means and set forkEvery to 1

Good idea - Many thanks!

Just tried it and it does indeed work, but now IntelliJ asks each time I manually run a test which task I should run it with. It also adds another step when doing things like running with coverage.

Wonder if there might be any other ways?

Of course it asks, how should it know which task is the right one. :slight_smile:
You could for example make a separate project for those tests, then IntelliJ should probably not need to ask which task to run.