Gradle complains about JUnit version of TestNG task

As stated in Gradle, TestNG compiles but does not run tests . I'm having trouble getting gradle to play well with TestNG. It seems that no tests are being performed, no matter what. So I went and tried to get gradle to run certain tests using the --tests command line --tests .

However, when I run this, the assembly fails with this message: Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6. Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6.

Now I know that TestNG is based on JUnit, so it may not be related to my earlier problem, but is there any chance that this means that TestNG is actually never used? Did this try instead of JUnit tests? As I know?

As a bonus: how can I upgrade my version of JUnit? I only enable 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' } } 
+2
source share
1 answer

It turns out that TestNG has never been used. We have a multi-project build, and subprojects were randomly configured to use JUnit. See fooobar.com/questions/981546 / ...

0
source

Source: https://habr.com/ru/post/981550/


All Articles