Making work SonarQube with integration tests in different directory
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 18 Jan 2017 21:56:23 +0000 (22:56 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 18 Jan 2017 21:56:23 +0000 (22:56 +0100)
SpringJava/Gradle/build-integTest.gradle
SpringJava/Gradle/build-test.gradle

index 575fc86..43604e9 100644 (file)
@@ -2,12 +2,14 @@ sourceSets {
     integTest {
         compileClasspath += main.output + test.output
         runtimeClasspath += main.output + test.output
+        output.classesDir = test.output.classesDir
+        output.resourcesDir = test.output.resourcesDir
     }
 }
 
 configurations {
-  integTestCompile.extendsFrom testCompile
-  integTestRuntime.extendsFrom testRuntime
+    integTestCompile.extendsFrom testCompile
+    integTestRuntime.extendsFrom testRuntime
 }
 
 
@@ -19,6 +21,12 @@ task integTest(type: Test) {
 
     testClassesDir = sourceSets.integTest.output.classesDir
     classpath = sourceSets.integTest.runtimeClasspath
+    reports.junitXml.destination = "${buildDir}/test-results/test"
+
+    // explicitly include or exclude tests
+    filter {
+        includeTestsMatching "*IntegrationShould"
+    }
 
     testLogging {
         events "PASSED", "FAILED", "SKIPPED"
index 3cc22f6..2d043e8 100644 (file)
@@ -1,4 +1,8 @@
 test {
+
+    // explicitly include or exclude tests
+    exclude '**/*IntegrationShould.class'
+
     testLogging {
         events "PASSED", "FAILED", "SKIPPED"
     }