Run single IntegTest from gradle:core:integTest preferable from Intellij IDE


I am working on a contribution tackling and I am at the phase trying to write an integration test to TDD my solution.

A problem that I am facing with this is that running /gradlew core:integTest takes a very long time and I would like to run only the test that I am writing.

I have tried ./gradlew core:integTest --test org.gradle.api.tasks.CopySymlinksIntegrationTest but it does not seem to apply in this case and the task fails.

It would be very helpful running the one test from the command line.

Since I am using IntelliJ it would be even more helpful if there is a way to setup this to work from the IDE controls. Without any setup I get the following exception:

java.lang.RuntimeException: You must set the 'integTest.gradleHomeDir' property to run the integration tests. The default passed was: 'null'`

at org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext.file(
at org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext.getGradleHomeDir(
at org.gradle.integtests.fixtures.executer.UnderDevelopmentGradleDistribution.<init>(
at org.gradle.integtests.fixtures.AbstractIntegrationTest.<init>(
at org.gradle.api.tasks.CopySymlinksIntegrationTest.<init>(CopySymlinksIntegrationTest.groovy)`

I have tried to set this via a -D jvm flag to point to both my gradle project source and to snapshot installed with -Pgradle_installPath but now I get the following exception:

at org.gradle.integtests.fixtures.AbstractIntegrationTest.<init>(
at org.gradle.api.tasks.CopySymlinksIntegrationTest.<init>(CopySymlinksIntegrationTest.groovy)
Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of 
Caused by: org.gradle.api.internal.classpath.UnknownModuleException: Cannot locate manifest for module 'gradle-docs' in classpath.

Thank you for your help!

If you setup your IntelliJ workspace by running ./gradlew idea and then opening the generated .ipr file will setup all this for you. Importing the project by simply opening up the build.gradle file will not apply this custom configuration.

Thank you fro your reply Mark!

I have already configured idea as per your instructions and most stuff work fine. But I haven’t figured out how to run individual tests from core:integTest.

My current workaround is that I am deleting all other tests leaving only the one I am working on. I was able to do progress but it is a bit cumbersome.


This is definitely possible, just run them like any other unit test. You will have to run ./gradlew intTestImage to generate the integration test image. Are you getting a similar error?


I’ve also strugled a bit with this. The Contribution guide is rather basic and doesn’t provide much useful details.

The suggested is to run all tests for subproject, for example:

./gradlew :<subproject>:check
./gradlew :dependencyManagement:check

Which is fine, but takes 35 min on my machine!
For some reason I’ve also some consistently failing unit tests when running them from IntelliJ IDEA.

Anyway, the solution is:

./gradlew -D<taskName>.single=<testClass> :<subproject>:check
./gradlew -DintegTest.single=MavenSnapshotResolveIntegrationTest :dependencyManagement:check

Would someone please add it to Contribution guide?

Best regards