Why is the incremental build not working for my integration test?


(Ian) #1

Hi,

Made a very simple project with unit & integration test. Integration test are using groovy and using spock in integration-test/groovy but every time i run it the incremental build feature never gets invoked and recompiles it every time - is this a known bug with the groovy plugin or have I done something wrong in the wiring?

PS If I remove the integration-test task and only run the unit tests (junit, in Java) the test task works as expect in that is reports everything is up to date?

Any Ideas?

Thanks,

Ian.

apply plugin: 'groovy'
  version = '1.1'
        repositories {
    mavenCentral()
    maven {
        url 'http://maven.springframework.org/milestone/'
    }
}
    configurations {
    integrationTestCompile {
        extendsFrom testCompile
    }
    integrationTestRuntime {
        extendsFrom integrationTestCompile, testRuntime
    }
      all*.exclude group: "commons-logging", module: "commons-logging"
}
    dependencies
        {
            testCompile "org.spockframework:spock-core:0.7-groovy-2.0";
            testCompile group: 'junit', name: 'junit', version: '4.+'
            groovy "org.codehaus.groovy:groovy:2.0.6"
            }
    sourceSets {
      integrationTest {
        groovy.srcDir file('src/integration-test/groovy')
        resources.srcDir file('src/integration-test/resources')
        compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
        runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
    }
}
  // integration testing: the application is deployed to the web container
task integrationTest(description: 'Runs the integration tests.', group: 'Verification', type: Test) {
    testClassesDir = sourceSets.integrationTest.output.classesDir
    classpath = sourceSets.integrationTest.runtimeClasspath
}
  check.dependsOn integrationTest

(Luke Daley) #2

If you run with ‘–info’ you will get some logging about why the task is out of date.


(Ian) #3

Thanks - Strange it says the files in the build/reports/test have changed (which they have due to the unit tests) but it shouldn’t be monitoring there - does this sound like a bug or have i missed something?

:integrationTest
Executing task ':integrationTest' due to:
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.unit.UnitTestPerson.html for task ':integrationTest' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.intergration.test.IntergationTestPerson.html for task ':integrationTest' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.intergration.test.html for task ':integrationTest' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/index.html for task ':integrationTest' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.unit.html for task ':integrationTest' has changed.
Starting process 'Gradle Worker 1'. Working directory: /Users/kellizer/projects/gradle-presentation/main-presentation Command: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -ea -cp /Users/kellizer/.gradle/caches/1.3/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain
An attempt to initialize for well behaving parent process finished.
Successfully started process 'Gradle Worker 1'
Gradle Worker 1 executing tests.
Gradle Worker 1 finished executing tests.
Process 'Gradle Worker 1' finished with exit value 0 (state: SUCCEEDED)
:test
Executing task ':test' due to:
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.unit.UnitTestPerson.html for task ':test' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.intergration.test.IntergationTestPerson.html for task ':test' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.intergration.test.html for task ':test' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/index.html for task ':test' has changed.
Output file /Users/kellizer/projects/gradle-presentation/main-presentation/build/reports/tests/com.dgug.unit.html for task ':test' has changed.
Starting process 'Gradle Worker 2'. Working directory: /Users/kellizer/projects/gradle-presentation/main-presentation Command: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -ea -cp /Users/kellizer/.gradle/caches/1.3/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain
Successfully started process 'Gradle Worker 2'
Gradle Worker 2 executing tests.
Gradle Worker 2 finished executing tests.
Process 'Gradle Worker 2' finished with exit value 0 (state: SUCCEEDED)
:check
Skipping task ':check' as it has no actions.
:build
Skipping task ':build' as it has no actions.

(Luke Daley) #4

You need to change this location for your new test task.

You’ll need to supply values for these three properties:

http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:testReportDir http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:testResultsDir http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:binResultsDir

It’s a deficiency that there aren’t non colliding defaults for this.


(Ian) #5

Thanks Luke - that solves it and that gets the incremental build working…


(Luke Daley) #6

Great. Happy testing!