jeudi 4 février 2016

Why are my integration tests are running when I run my unit tests?

I have spring, spring MVC and gadle based web application. I have configured unit as well as integration tests in the app.

When I run the gradle test, it also runs my integration test. I am not sure why.

I have kept my integration test in separate source folder.

My unit tests are in src/test/java and integration tests are in src/integTest/java.

Below is my build.gradle

check.dependsOn integrationTest

tasks.withType(Test) {
    reports.html.destination = file("${reporting.baseDir}/${name}")
}



sourceSets {
    integrationTest {
        java {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir file('src/integTest/java')
        }
        resources.srcDir file('src/integTest/resources')
    }
}

configurations {
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

task integrationTest(type: Test) {
    description = "Runs the integration tests."
    group = "verification"
    testClassesDir = sourceSets.integrationTest.output.classesDir
    classpath = sourceSets.integrationTest.runtimeClasspath
    outputs.upToDateWhen { false }

    testLogging {
        events "skipped", "failed"
    }
}

Aucun commentaire:

Enregistrer un commentaire