When you have multiple interacting things (like tasks/extensions/other plugins), you should just use Gradle TestKit. The ProjectBuilder isn’t a full Gradle runtime environment, so it can’t test everything in the same way as a “real” Gradle build.
A guide on testing Gradle plugins is going to published soon (likely sometime next week). It will give you a good overview on the different testing approaches. I will link to it as soon as it is ready.
Thank you for the suggestion @sterling. My problem with the GradleRunner option is that it doesn’t allow me to query the project, it seems to me that I can only run tasks with it and test on the results of the task.
@bmuschko thanks! I am looking forward to seeing that guide.
My problem with the GradleRunner option is that it doesn’t allow me to query the project, it seems to me that I can only run tasks with it and test on the results of the task.
You have access to the full Gradle API. The approach would simply look different. In the build script under test you’d write a task that verifies what you need. From the GradleRunner API you execute that task.