From 99fdacd0dc1475d40955280ae7f6e78438f40200 Mon Sep 17 00:00:00 2001 From: Clinton Alexander Date: Thu, 9 Jun 2016 14:11:18 +0100 Subject: [PATCH] Integration tests now run separately from unit tests (with caveats described in the gradle file) --- build.gradle | 29 +++++++++++++++++-- .../com/r3corda/core/testing/IRSDemoTest.kt | 0 .../r3corda/core/testing/IRSSimulationTest.kt | 0 .../r3corda/core/testing/TraderDemoTest.kt | 0 4 files changed, 27 insertions(+), 2 deletions(-) rename src/{test => integration-test}/kotlin/com/r3corda/core/testing/IRSDemoTest.kt (100%) rename src/{test => integration-test}/kotlin/com/r3corda/core/testing/IRSSimulationTest.kt (100%) rename src/{test => integration-test}/kotlin/com/r3corda/core/testing/TraderDemoTest.kt (100%) diff --git a/build.gradle b/build.gradle index 6af144aef3..99ee6ad948 100644 --- a/build.gradle +++ b/build.gradle @@ -44,10 +44,23 @@ repositories { jcenter() } +sourceSets { + integrationTest { + kotlin { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/integration-test/kotlin') + } + } +} + //noinspection GroovyAssignabilityCheck configurations { // we don't want isolated.jar in classPath, since we want to test jar being dynamically loaded as an attachment runtime.exclude module: 'isolated' + + integrationTestCompile.extendsFrom testCompile + integrationTestRuntime.extendsFrom testRuntime } // This is required for quasar. I think. @@ -70,6 +83,10 @@ dependencies { testCompile 'junit:junit:4.12' testCompile 'org.assertj:assertj-core:3.4.1' testCompile 'com.pholser:junit-quickcheck-core:0.6' + + // Integration test helpers + integrationTestCompile 'junit:junit:4.12' + integrationTestCompile 'org.assertj:assertj-core:3.4.1' } // Package up the demo programs. @@ -99,8 +116,7 @@ task getTraderDemo(type: CreateStartScripts) { // Force windows script classpath to wildcard path to avoid the 'Command Line Is Too Long' issues // with generated scripts. Include Jolokia .war explicitly as this isn't picked up by wildcard -tasks.withType(CreateStartScripts) -{ +tasks.withType(CreateStartScripts) { doLast { windowsScript.text = windowsScript .readLines() @@ -109,6 +125,15 @@ tasks.withType(CreateStartScripts) } } +task integrationTest(type: Test) { + testClassesDir = sourceSets.integrationTest.output.classesDir + classpath = sourceSets.integrationTest.runtimeClasspath +} + +tasks.withType(Test) { + reports.html.destination = file("${reporting.baseDir}/${name}") +} + quasarScan.dependsOn('classes', 'core:classes', 'contracts:classes', 'node:classes') applicationDistribution.into("bin") { diff --git a/src/test/kotlin/com/r3corda/core/testing/IRSDemoTest.kt b/src/integration-test/kotlin/com/r3corda/core/testing/IRSDemoTest.kt similarity index 100% rename from src/test/kotlin/com/r3corda/core/testing/IRSDemoTest.kt rename to src/integration-test/kotlin/com/r3corda/core/testing/IRSDemoTest.kt diff --git a/src/test/kotlin/com/r3corda/core/testing/IRSSimulationTest.kt b/src/integration-test/kotlin/com/r3corda/core/testing/IRSSimulationTest.kt similarity index 100% rename from src/test/kotlin/com/r3corda/core/testing/IRSSimulationTest.kt rename to src/integration-test/kotlin/com/r3corda/core/testing/IRSSimulationTest.kt diff --git a/src/test/kotlin/com/r3corda/core/testing/TraderDemoTest.kt b/src/integration-test/kotlin/com/r3corda/core/testing/TraderDemoTest.kt similarity index 100% rename from src/test/kotlin/com/r3corda/core/testing/TraderDemoTest.kt rename to src/integration-test/kotlin/com/r3corda/core/testing/TraderDemoTest.kt