I use junit assumptions to decide whether to run a test or not.
Tests in which the error fails are ignored / skipped within junit.
I wonder why the missed tests are not reported as "missed"?
Please see an example:
import static org.junit.Assert.fail;
import org.junit.Assume;
import org.junit.Test;
public class AssumptionTest {
@Test
public void skipAssumptionFailureTest() {
Assume.assumeTrue("foo".equals("bar"));
fail("This should not be reached!");
}
}
Running this test in a maven project results in:
Running AssumptionTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
I would prefer this test to be reported as “skipped”. Is there a chance to achieve this?
(junit 4.8.1; maven 2.2.1; java 1.6.0_21)
source
share