Skip to content

ProfileValueUtils#isTestEnabledInThisEnvironment should use current test class to determine IfProfileValue annotation [SPR-4526] #9203

Closed

Description

@spring-projects-issues

Noel Flicken opened SPR-4526 and commented

ProfileValueUtils#isTestEnabledInThisEnvironment should use current test class to determine whether IfProfileValue annotation is set. Using Method#getDeclaringClass in not sufficient due to possible inheritance of testing methods.

Consider the following test classes.

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({})
public class GeneralTest {
	@Test public void generalTest()
	{
		
	}
}

@IfProfileValue(name="run", value="true")
public class SpecificTest extends GeneralTest {
	@Test public void specificTest()
	{
		
	}
}

The test "generalTest" is always run, regardless of the value of "run" profile value.
Expected behavior: GeneralTest#generalTest should always run, but SpecificTest#generalTest should only run if "run" profile value is set to "true".


Attachments:

Issue Links:

Activity

  1. spring-projects-issues commented on Feb 29, 2008

    @spring-projects-issues
    CollaboratorAuthor

    Noel Flicken commented

    Test files mentioned in description of issue.

  2. spring-projects-issues commented on Mar 5, 2008

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    This should be fixed in the upcoming 2.5.3 snapshot now. Thanks for the report!

    Juergen

  3. added
    type: bug
    in: test
    on Jan 11, 2019
  4. added this to the 2.5.3 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: testtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions