ttt307307 / junitparams

Automatically exported from code.google.com/p/junitparams
0 stars 0 forks source link

org.junit.Assume does not work as expected with junitparams #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a plain JUNit testcase with assume => assume ok
2. Create a junitparams testcase with assume => assume fails

Is it possible to add the same behaviour to the junitparam Runner as is used 
for the default runner. I need the assume to skip certain tests because they 
are not to be executed in certain environments. 
Or is it possible to configure a custon annotation that tells the runner to 
skip the test under certain circumstandes.

@IgnoreWhen(condition())

So far the best solution i came up with is to use the assume to 
skip a test (which is then still marked as success with the default junit 
runner).

What version of the product are you using? On what operating system?
junit param 0.5.0

Please provide any additional information below.

Example, assume fails.

@RunWith(JUnitParamsRunner.class)
public class AssumeTest {

    @Test
    @Parameters
    public void testAssume(String value) {
        Assume.assumeTrue(1 == 2);
    }

    protected Object[] parametersForTestAssume() throws InitializationException {
        final Object[] parameters = new Object[1];
        parameters[0] = new Object[] { "GB" };
        return parameters;
    }

}

Assume wihtout junit params does not fail:
public class AssumeTestDefault {

    @Test
    public void testAssume() {
        Assume.assumeTrue(1 == 2);
    }

}

Original issue reported on code.google.com by andreas....@gmail.com on 14 May 2012 at 8:52

GoogleCodeExporter commented 8 years ago
Thanks for the issue. Works now as expected (i.e. like normal assumptions). 

Original comment by lipinski...@gmail.com on 14 May 2012 at 9:24