From da9a1b100639e7eb5a7986952f5a1f3ba0d675e6 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Wed, 18 Nov 2015 12:48:31 +0000 Subject: Add infrastructure for adding integration tests using testkit --- gradle/integTest.gradle | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 gradle/integTest.gradle (limited to 'gradle/integTest.gradle') diff --git a/gradle/integTest.gradle b/gradle/integTest.gradle new file mode 100644 index 0000000..07b0743 --- /dev/null +++ b/gradle/integTest.gradle @@ -0,0 +1,50 @@ +sourceSets { + integTest { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + } +} + +configurations { + integTestCompile.extendsFrom testCompile + integTestRuntime.extendsFrom testRuntime +} + +task integTest(type: Test) { + shouldRunAfter 'test' + testClassesDir = sourceSets.integTest.output.classesDir + classpath = sourceSets.integTest.runtimeClasspath + +} +check.dependsOn(integTest) + +plugins.withType(org.gradle.plugins.ide.idea.IdeaPlugin) { + idea { + module { + testSourceDirs += sourceSets.integTest.groovy.srcDirs + testSourceDirs += sourceSets.integTest.resources.srcDirs + scopes.TEST.plus.add(configurations.integTestCompile) + scopes.TEST.plus.add(configurations.integTestRuntime) + } + } +} + + +// START SNIPPET test-logic-classpath +// Write the plugin's classpath to a file to share with the tests +task createClasspathManifest { + def outputDir = file("$buildDir/$name") + + inputs.files sourceSets.main.runtimeClasspath + outputs.dir outputDir + + doLast { + outputDir.mkdirs() + file("$outputDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n") + } +} + +// Add the classpath file to the test runtime classpath +dependencies { + integTestRuntime files(createClasspathManifest) +} \ No newline at end of file -- cgit