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
This commit is contained in:
Sam Brannen 2013-01-10 16:42:44 +01:00
parent 0b612d651e
commit 4ae9cf7cf1
3 changed files with 17 additions and 10 deletions

View File

@ -640,10 +640,22 @@ project("spring-webmvc-portlet") {
project("spring-test") {
description = "Spring TestContext Framework"
test {
useJUnit()
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()
// "TestCase" classes are run by other test classes, not the build.
exclude "**/*TestCase.class"
}
dependencies {
compile(project(":spring-core"))
optional(project(":spring-beans"))

View File

@ -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 {
@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 {
@AfterTransaction
public void afterTransaction() {
// See SPR-8116
//org.testng.Assert.fail("always failing afterTransaction()");
org.testng.Assert.fail("always failing afterTransaction()");
}
}

View File

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