Closed
Description
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:
- GeneralTest.java (347 bytes)
- SpecificTest.java (234 bytes)
Issue Links:
- Class-level @IfProfileValue overrides method-level @IfProfileValue settings [SPR-5902] #10571 Class-level
@IfProfileValue
overrides method-level@IfProfileValue
settings