Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all tests are executed in the Gradle build [SPR-11384] #16011

6 tasks done
spring-projects-issues opened this issue Feb 3, 2014 · 1 comment
6 tasks done


Copy link

@spring-projects-issues spring-projects-issues commented Feb 3, 2014

Sam Brannen opened SPR-11384 and commented

Status Quo

Although the naming convention for test classes within the test suite for the Spring Framework has always been "*Tests" (as opposed to the Maven convention of "*Test"), time and time again a test class slips into version control with a "Test" suffix. This causes the tests in question to be ignored by the build.


In Eclipse, type Ctrl + Shift + T and then enter "org.springframework.*.*Test " (without the quotes but with the trailing space). This will display a dialog containing all classes currently named "*Test" as opposed to "*Tests". As of the time of this writing, this results in the following:

  • org.springframework.context.groovy.ScopeTest
  • org.springframework.core.GenericTypeResolverTests.ITest
  • org.springframework.core.type.CachingMetadataReaderLeakTest
  • org.springframework.jdbc.datasource.DelegatingDataSourceTest
  • org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControlTest
  • org.springframework.test.context.junit4.aci.annotation.InitializerWithoutConfigFilesOrClassesTest
  • org.springframework.test.context.junit4.profile.resolver.ClassNameActiveProfilesResolverTest
  • org.springframework.test.context.ContextLoaderUtilsActiveProfilesTests.*:
    • NullActiveProfilesResolverTest
    • NoDefaultConstructorActiveProfilesResolverTest
    • FooActiveProfilesResolverTest
    • InheritedFooActiveProfilesResolverTest
    • MergedInheritedFooActiveProfilesResolverTest
    • OverridenInheritedFooActiveProfilesResolverTest
    • ConflictingResolverAndProfilesTest
    • ConflictingResolverAndValueTest
    • ConflictingProfilesAndValueTest
  • org.springframework.test.context.OverriddenMetaAnnotationAttributesTests.MetaLocationsConfigTest
  • org.springframework.test.context.OverriddenMetaAnnotationAttributesTests.MetaValueConfigTest
  • org.springframework.test.context.OverriddenMetaAnnotationAttributesTests.OverriddenMetaLocationsConfigTest
  • org.springframework.test.context.OverriddenMetaAnnotationAttributesTests.OverriddenMetaValueConfigTest
  • org.springframework.test.context.web.WebTest
  • org.springframework.util.xml.DomContentHandlerTest
  • org.springframework.web.filter.HiddenHttpMethodFilterTest

Furthermore, AnnotationDrivenStaticEntityMockingControlTest contains broken tests.


  1. Rename all *Test classes:
    • Real test classes named "*Test" must be renamed to "*Tests".
    • Internal test classes that are not actually executed by the build should be renamed to "*TestCase".
    • The @WebTest test annotation should be renamed to something ending in neither "Test" nor "Tests".
  2. Broken tests in AnnotationDrivenStaticEntityMockingControlTest should be disabled and fixed in conjunction with a separate, dedicated issue.
  3. Modify Gradle build to include "*Test" in addition to "*Tests" for test classes.

Affects: 4.0.1

Issue Links:

  • #16012 Fix off-by-one regression in AbstractMethodMockingControl

Referenced from: commits b8ed2f4

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 3, 2014

Sam Brannen commented

This has been addressed as described in the comments for GitHub commit b8ed2f4:

Ensure all tests are executed in the Gradle build

Prior to this commit several test classes named "*Test" were not
recognized as tests by the Gradle build. This is due to the configured
inclusion of '**/*Tests.*' which follows Spring's naming convention for
test classes.

This commit addresses this issue by:

  • Renaming real test classes consistently to "*Tests".
  • Renaming internal test classes to "*TestCase".
  • Renaming @WebTest to @WebTestStereotype.
  • Disabling broken tests in AnnoDrivenStaticEntityMockingControlTest.
  • Modifying the Gradle build configuration so that classes ending in
    either "*Tests" or "*Test" are considered test classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants