On 27/03/10 5:13 AM, Jason Hatton wrote:
I am trying to set up a way to run integration tests with a separate source set and an integrationTest task. I am having trouble excluding a base Junit TestCase class. I followed a similar example in the User Guide for the version (0.8) that I am using.

Here are the important pieces related to setting things up: Note: this is all under a subprojects configuration on the parent build.gradle file in a multiproject setup.

configurations {
        integrationTestCompile { extendsFrom testCompile }
integrationTestRuntime { extendsFrom integrationTestCompile, testRuntime }
}

sourceSets {
        integrationTest {
            java {
                srcDirs = ['integrationTest']
            }
            classesDir = main.classesDir
            compileClasspath = configurations.testCompile
runtimeClasspath = classes + sourceSets.main.classes + configurations.integrationTestRuntime
        }
}

task integrationTest(dependsOn: 'compileIntegrationTestJava', type: Test) {
        testClassesDir = sourceSets.integrationTest.classesDir
classpath = (files(sourceSets.main.classesDir)) + sourceSets.integrationTest.runtimeClasspath
}

integrationTest.configure {
        useJUnit() {
            fork(forkMode: ForkMode.ONCE, jvmArgs: ["-Xmx256m"])
        }
        exclude '**/*BaseTestCase*'
}

This was a bug on 0.8 that has been fixed in trunk. It will be available in the 0.9 release. By specifying the above, the test task will run all junit tests it finds, except for anything whose name matches **/*BaseTestCase*'.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to