GradleRunner running Java Tests

I have a plugin that adjusts the main Test task as well as creating a few new ones on the fly.

I’d like to test the execution of these tests as part of the plugin’s src/main/test using TestKit/GradleRunner. I’ve tried a number of options, none of which worked:

  • “test projects” as subprojects of the main plugin project. The main issue with this one is the inability to use project-based dependency in buildscript / pluginManagement. And in retrospect, even if I could get that to work, the plugin jar would not even be available (generally) when Gradle configures the subprojects.
  • “test projects” defined in plugin’s src/test/resources directory. The idea here being that the projects are copied to the test resources build directory - I use a class-path look up to know the location and set the GradleRunner’s work directrory. The problem with this one is intermittent - usually the issue is the inability to locate the generated subproject test classes (compileTestClasses shows NO_SOURCE). No idea why.

Is this even possible consistently? Any pointers?

Is the only option to test plugin tasks by deploying and using a standalone (unrelated to the plugin project) test project?

Guess not. Shame :frowning: