Some time ago I wrote a blogpost on our companies Blog about how we accomplished to create an integration-testset for our gradle projects. Since this post was written in german I wanted to translate and repost it here.
First you have to declare a new sourceSet for your integration tests in your build.gradle file. Additionally I’ve created the integrationTest task which can be used to execute the integration tests on their own.
If you use IntelliJ IDEA as your IDEA make sure to upgrade to the version 2016.1 or higher. Otherwise it might happen that the gradle source sets don’t work as expected (see this blogpost by Jetbrains).
Now your unit and integration tests are completely seperated. You can execute your integration tests using the
integrationTest task and your unit tests with the