diff --git a/build.gradle b/build.gradle index 8a3207ccc85..e5913130731 100644 --- a/build.gradle +++ b/build.gradle @@ -188,6 +188,7 @@ configure(allprojects) { project -> exclude group: "junit", name: "junit" } dependency "org.testng:testng:7.4.0" + dependency "org.junit.support:testng-engine:1.0.1" dependency "org.hamcrest:hamcrest:2.1" dependency "org.awaitility:awaitility:3.1.6" dependency "org.assertj:assertj-core:3.20.2" diff --git a/spring-test/spring-test.gradle b/spring-test/spring-test.gradle index 365ce7d316f..026507a0281 100644 --- a/spring-test/spring-test.gradle +++ b/spring-test/spring-test.gradle @@ -77,43 +77,23 @@ dependencies { testRuntimeOnly("org.junit.vintage:junit-vintage-engine") { exclude group: "junit", module: "junit" } + testRuntimeOnly("org.junit.support:testng-engine") testRuntimeOnly("org.glassfish:javax.el") testRuntimeOnly("com.sun.xml.bind:jaxb-core") testRuntimeOnly("com.sun.xml.bind:jaxb-impl") } -task junit(type: Test) { - description = "Runs JUnit 4 and JUnit Jupiter tests." +test { + description = "Runs JUnit 4, JUnit Jupiter, and TestNG tests." useJUnitPlatform { + includeEngines "junit-vintage", "junit-jupiter", "testng" excludeTags "failing-test-case" } + // We use `include` instead of `filter.includeTestsMatching`, since + // the latter results in some tests being executed/reported + // multiple times. include(["**/*Tests.class", "**/*Test.class"]) - exclude(["**/testng/**/*.*"]) systemProperty("testGroups", project.properties.get("testGroups")) // Java Util Logging for the JUnit Platform. // systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager") } - -task testNG(type: Test) { - description = "Runs TestNG tests." - useTestNG() - include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"]) - systemProperty("testGroups", project.properties.get("testGroups")) - // Show STD_OUT & STD_ERR of the test JVM(s) on the console: - // testLogging.showStandardStreams = true - // forkEvery 1 -} - -test { - description = "Runs all tests." - dependsOn junit, testNG - exclude(["**/*.*"]) -} - -task aggregateTestReports(type: TestReport) { - description = "Aggregates JUnit and TestNG test reports." - destinationDir = test.reports.html.outputLocation.get().getAsFile() - reportOn junit, testNG -} - -check.dependsOn aggregateTestReports