As stated in Gradle compiles but does not run TestNG tests I am having some trouble getting gradle to play nicely with TestNG. It just seems like no tests are being executed no matter what I try. So I went and tried to force gradle into executing specific tests using the --tests
command line parameter.
However, when I run this the build fails with this message:
Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6.
Now I know TestNG is based on JUnit, so it might be unrelated to my earlier issue, but is there a chance that this indicated TestNG is actually never really used? Is it trying to run the tests as JUnit tests instead? How would I know?
As a bonus: how can I upgrade the used JUnit version? I am only including 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'
}
}