Created
February 20, 2018 18:20
-
-
Save elderfo/08bff7eb0f65743abbf7fa521a567a6a to your computer and use it in GitHub Desktop.
Integration Test Source Set for Gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
configurations { | |
integrationTestCompile.extendsFrom testCompile | |
integrationTestRuntime.extendsFrom testRuntime | |
} | |
sourceSets { | |
integrationTest { | |
java.srcDir file('src/integration-test/java') | |
resources.srcDir file('src/integration-test/resources') | |
compileClasspath += sourceSets.main.output + sourceSets.test.output + configurations.testRuntime | |
runtimeClasspath += sourceSets.main.output + sourceSets.test.output + configurations.testRuntime | |
} | |
} | |
task integrationTest(type: Test) { | |
group 'Verification' | |
description 'Runs the integration tests.' | |
testClassesDirs = sourceSets.integrationTest.output.classesDirs | |
classpath = sourceSets.integrationTest.runtimeClasspath | |
} |
@kyxap - there isn't anything wrong with the plugin configuration, but you will need to add a dependency handler in order to be able to add additional dependencies for the source set. An example if this were a Kotlin DSL build gradle:
fun DependencyHandler.integrationTestApiDependenciesMetadata(dependencyNotation: Any): Dependency? =
add("integrationTestApiDependenciesMetadata", dependencyNotation)
Hi,
There are possible to add all described staff by single line with this plugin.
https://github.com/Softeq/itest-gradle-plugin
https://softeq.github.io/itest-gradle-plugin/
- Ilya
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it still work?
How do you set dependencies with this config?
For example:
I'm getting:
> Could not find method integrationTestCompile() for arguments [{group=junit, name=junit, version=4.12}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.