为什么在运行单元测试时,我的集成测试正在运行?

时间:2016-02-05 04:27:39

标签: unit-testing gradle integration-testing

我有春季,春季MVC和基于gadle的网络应用程序。我在应用程序中配置了单元和集成测试。

当我运行gradle测试时,它还会运行我的集成测试。我不知道为什么。

我将集成测试保存在单独的源文件夹中。

我的单元测试在src / test / java中,集成测试在src / integTest / java中。

以下是我的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"
    }
}

1 个答案:

答案 0 :(得分:0)

您需要删除 #include <iostream> using namespace std; class CSE { private: char Name; double Roll; public: void getN(char N, double RN) { Name = N; Roll = RN; } }; char EnterName() { cout << "Enter the name of the student" << ; } char EnterRN() { cout << "enter the rn" << ; }; int main() { CSE nnn; nnn.getN(N, RN); cout << "enter the name" << nnn.EnterName << endl; cout << "enter the roll" << nnn.EnterRN << endl; return 0; }