Simplify test includes & excludes in Gradle build
This commit aligns our include and exclude filters for test classes with Gradle's standard patterns. Specifically, our patterns now end with ".class" instead of ".*". The aforementioned change makes the exclusion of inner classes unnecessary. Thus, patterns for test classes ending with "TestCase" or "TestSuite" have been deleted. Furthermore, the include and exclude patterns previously used in the spring-test module made it impossible for the FailingBeforeAndAfterMethodsTests class in the 'testng' package to ever be executed by the build. This has been addressed by renaming our JUnit and TestNG variants of FailingBeforeAndAfterMethodsTests and moving the TestNG variant into the 'junit' package so that it can be picked with our standard include pattern for JUnit-based tests.
This commit is contained in:
parent
d30128396e
commit
cf3b2b1a4d
22
build.gradle
22
build.gradle
|
@ -66,8 +66,8 @@ configure(allprojects) { project ->
|
|||
systemProperty("java.awt.headless", "true")
|
||||
systemProperty("testGroups", project.properties.get("testGroups"))
|
||||
scanForTestClasses = false
|
||||
include(["**/*Tests.*", "**/*Test.*"])
|
||||
exclude "**/Abstract*.*"
|
||||
include(["**/*Tests.class", "**/*Test.class"])
|
||||
exclude "**/Abstract*.class"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -830,25 +830,17 @@ project("spring-test") {
|
|||
useTestNG()
|
||||
// forkEvery 1
|
||||
scanForTestClasses = false
|
||||
include(["**/testng/**/*Tests.*", "**/testng/**/*Test.*"])
|
||||
// "TestCase" classes are run by other test classes, not the build.
|
||||
exclude(["**/Abstract*.*", "**/*TestCase.class", "**/FailingBeforeAndAfterMethodsTests.class"])
|
||||
// Show standard out and standard error of the test JVM(s) on the console
|
||||
include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
|
||||
exclude "**/Abstract*.class"
|
||||
// Show STD_OUT & STD_ERR of the test JVM(s) on the console:
|
||||
// testLogging.showStandardStreams = true
|
||||
}
|
||||
|
||||
test {
|
||||
dependsOn testNG
|
||||
useJUnit()
|
||||
include(["**/*Tests.*", "**/*Test.*"])
|
||||
// In general, we exclude all classes under the 'testng' package.
|
||||
// "TestCase" classes are run by other test classes, not the build.
|
||||
// "TestSuite" classes only exist as a convenience to the develper; they
|
||||
// should not be run by the build.
|
||||
exclude(["**/testng/**/*.*", "**/Abstract*.*", "**/*TestCase.class", "**/*TestSuite.class"])
|
||||
// FailingBeforeAndAfterMethodsTests is actually a JUnit-based test which
|
||||
// itself runs TestNG manually in order to test our TestNG support.
|
||||
include "**/testng/FailingBeforeAndAfterMethodsTests"
|
||||
include(["**/*Tests.class", "**/*Test.class"])
|
||||
exclude(["**/Abstract*.class", "**/testng/**/*.*"])
|
||||
}
|
||||
|
||||
task aggregateTestReports(type: TestReport) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
|
@ -60,12 +60,12 @@ import org.springframework.test.context.transaction.BeforeTransaction;
|
|||
* @since 2.5
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class FailingBeforeAndAfterMethodsTests {
|
||||
public class FailingBeforeAndAfterMethodsJUnitTests {
|
||||
|
||||
protected final Class<?> clazz;
|
||||
|
||||
|
||||
public FailingBeforeAndAfterMethodsTests(final Class<?> clazz) {
|
||||
public FailingBeforeAndAfterMethodsJUnitTests(final Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.context.testng;
|
||||
package org.springframework.test.context.junit4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
@ -30,6 +30,8 @@ import org.springframework.test.context.TestContext;
|
|||
import org.springframework.test.context.TestExecutionListener;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.support.AbstractTestExecutionListener;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
|
||||
import org.springframework.test.context.transaction.AfterTransaction;
|
||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||
import org.testng.ITestContext;
|
||||
|
@ -62,7 +64,7 @@ import org.testng.TestNG;
|
|||
* @since 2.5
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class FailingBeforeAndAfterMethodsTests {
|
||||
public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||
|
||||
protected final Class<?> clazz;
|
||||
protected final int expectedTestStartCount;
|
||||
|
@ -71,7 +73,7 @@ public class FailingBeforeAndAfterMethodsTests {
|
|||
protected final int expectedFailedConfigurationsCount;
|
||||
|
||||
|
||||
public FailingBeforeAndAfterMethodsTests(final Class<?> clazz, final int expectedTestStartCount,
|
||||
public FailingBeforeAndAfterMethodsTestNGTests(final Class<?> clazz, final int expectedTestStartCount,
|
||||
final int expectedTestSuccessCount, final int expectedFailureCount,
|
||||
final int expectedFailedConfigurationsCount) {
|
||||
this.clazz = clazz;
|
Loading…
Reference in New Issue