Gradle在TestNG任务上抱怨JUnit版本

时间:2015-01-27 11:23:29

标签: unit-testing junit gradle testng

Gradle compiles but does not run TestNG tests中所述,我在使用TestNG玩得很好时遇到了一些麻烦。无论我尝试什么,似乎都没有执行任何测试。所以我去尝试使用--tests命令行参数强制gradle执行特定的测试。

然而,当我运行它时,构建失败并显示以下消息: Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6.

现在我知道TestNG基于JUnit,所以它可能与我之前的问题无关,但有可能这表明TestNG实际上从未真正使用过吗?它是否试图以JUnit测试运行测试?我怎么知道?

作为奖励:如何升级使用过的JUnit版本?我只包括testng:

    dependencies {
        compile 'javax.inject:javax.inject:1'
        compile 'org.springframework:spring-context:4.1.4.RELEASE'
        compile 'org.springframework:spring-core:4.1.4.RELEASE'
        compile 'org.springframework:spring-beans:4.1.4.RELEASE'
        compile 'org.springframework.data:spring-data-mongodb:1.6.1.RELEASE'
        compile 'org.springframework.data:spring-data-jpa:1.7.1.RELEASE'
        compile 'org.hibernate:hibernate-entitymanager:4.3.8.Final'
        compile 'mysql:mysql-connector-java:5.1.34'
        compile 'commons-logging:commons-logging:1.2'
        testCompile 'org.springframework:spring-test:4.1.4.RELEASE'
        testCompile 'org.testng:testng:6.1.1'
    }
}

1 个答案:

答案 0 :(得分:0)

事实证明,确实从未使用过TestNG。我们有一个多项目构建,并且子项目意外地仍然配置为使用JUnit。见https://stackoverflow.com/a/28171157/1788160

相关问题