Browse Source

Ensure JUnit & TestNG tests run in spring-test

Prior to this commit, the Gradle build configuration only executed
TestNG-based tests and effectively disabled all JUnit-based tests in the
spring-test module. Furthermore, TestNG-based tests were not properly
reported in Bamboo CI builds.

This commit ensures that both JUnit and TestNG tests are executed in the
Gradle build by defining a new testNG task within the spring-test
configuration. The test task now depends on the new testNG task.
Furthermore, the testNG task makes use of Gradle 1.3's support for
generating test reports for TestNG tests alongside reports for JUnit
tests. The net effect is that all tests are executed and reportedly
properly in Bamboo builds on the CI server.

- Enabled both JUnit and TestNG tests for the spring-test module.
- Corrected bugs in FailingBeforeAndAfterMethodsTests introduced in
  commit 3d1b3868fe.
- Deleted the now obsolete SPR-9398.txt file.

Issue: SPR-9398
pull/214/merge
Sam Brannen 13 years ago
parent
commit
4ae9cf7cf1
  1. 14
      build.gradle
  2. 8
      spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java
  3. 3
      spring-test/src/test/java/org/springframework/test/context/testng/SPR-9398.txt

14
build.gradle

@ -640,10 +640,22 @@ project("spring-webmvc-portlet") { @@ -640,10 +640,22 @@ project("spring-webmvc-portlet") {
project("spring-test") {
description = "Spring TestContext Framework"
task testNG(type: Test) {
useTestNG()
// "TestCase" classes are run by other test classes, not the build.
exclude "**/*TestCase.class"
// Generate TestNG reports alongside JUnit reports.
testReport true
}
test {
dependsOn testNG
useJUnit()
useTestNG()
// "TestCase" classes are run by other test classes, not the build.
exclude "**/*TestCase.class"
}
dependencies {
compile(project(":spring-core"))
optional(project(":spring-beans"))

8
spring-test/src/test/java/org/springframework/test/context/testng/FailingBeforeAndAfterMethodsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -237,8 +237,7 @@ public class FailingBeforeAndAfterMethodsTests { @@ -237,8 +237,7 @@ public class FailingBeforeAndAfterMethodsTests {
@BeforeTransaction
public void beforeTransaction() {
// See SPR-8116
//org.testng.Assert.fail("always failing beforeTransaction()");
org.testng.Assert.fail("always failing beforeTransaction()");
}
}
@ -251,8 +250,7 @@ public class FailingBeforeAndAfterMethodsTests { @@ -251,8 +250,7 @@ public class FailingBeforeAndAfterMethodsTests {
@AfterTransaction
public void afterTransaction() {
// See SPR-8116
//org.testng.Assert.fail("always failing afterTransaction()");
org.testng.Assert.fail("always failing afterTransaction()");
}
}

3
spring-test/src/test/java/org/springframework/test/context/testng/SPR-9398.txt

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
TODO [SPR-9398] re-enable TestNG support for spring-test.
These TestNG test classes are currently not run at all.
Loading…
Cancel
Save