Why is the new gradle filtering function not working for my build script?

I am working on a “project” that has the following structure:

proj
  - dbfit-junit/module
    - db1
    - db2

To provide some background information: all of these “modules” (db1, db2) have JUnit tests that use FitNesseRunner to integrate into Bamboo.

My gradle script looks like this:

apply plugin: 'java'


repositories {
    mavenCentral()
}

dependencies {
    compile files(fileTree("lib"))
    testCompile "junit:junit:4.11"
}

ext {
    dbFitModuleDir = file("dbfit-junit/module")
    dbFitModules = dbFitModuleDir.listFiles({f -> f.isDirectory()} as java.io.FileFilter).collect{it.name}
}

dbFitModules.each { module ->
    sourceSets.create("${module}SourceSet") {
        java.srcDir new File(dbFitModuleDir, module)
        compileClasspath = sourceSets.main.output + configurations.testRuntime
        runtimeClasspath = output + sourceSets.main.output + configurations.testRuntime
    }

    task "dbFit${module.capitalize()}"(type: Test) {
        testClassesDir = sourceSets."${module}SourceSet".output.classesDir
        classpath = sourceSets."${module}SourceSet".runtimeClasspath
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.10'
}

So far, everything is working as expected, and I can dynamically create module-specific gradle tasks and run tests.

However, one does not work for me. I learned from the release note of Gralde 1.10 that there is a new feature called "test filtering", but it does not affect any of the tasks that I execute from the command line (for example, gradlew dbFitDb1 --tests * DataIntegrity).

-tests, . , -. script ..

!

+3
1

, , @RunWith JUnit. Gradle . "test.single", .

https://issues.gradle.org/browse/GRADLE-3112

+1

All Articles