Possible duplicate:
Conditionally ignoring tests in JUnit 4
I have a set of system tests that run with Parameterizedrunner and that I would like to run in different environments. Some of the tests should only be run in non-production environments, and when I go into production, I would like them to be ignored, so I'm looking for a way to say:
@Test
public void dangerousTest() {
if (isProduction(environment)) ignore();
environment.launchMissilesAt(target);
assertThat(target, is(destroyed()));
}
The problem is that JUnit does not provide a method ignore()to ignore the test case at runtime. Also Assume.assumeTrue(isNotProduction(environment)), it doesn't seem to work with Parameterizedrunner - it just marks the tests as passed, not ignored. Any ideas on how something equivalent can be achieved with limitations that:
- You must use
Parameterizedrunner in the set - should tests appear ignored if the package is launched during production?
source
share