Possible Duplicate:
Conditionally ignoring tests in JUnit 4
I have a suite of system tests that are run with Parameterized runner and that I would like to run against different environments. Some of the tests should only run in non-production environments, and when run in production I would like to see them as ignored, so I'm looking for a way to say:
@Test public void dangerousTest() { if (isProduction(environment)) ignore(); // JUnit doesn't provide ignore() environment.launchMissilesAt(target); assertThat(target, is(destroyed())); } The issue is that JUnit doesn't provide ignore() method to ignore a test case at run time. Furthermore, Assume.assumeTrue(isNotProduction(environment)) doesn't seem to work with Parameterized runner -- it simply marks the tests as passed, not ignored. Any ideas how something equivalent can be achieved with the constraints that:
- the suite needs to use
Parameterizedrunner - the tests need to appear as ignored if the suite is run in production?