Given a certain set of parameters is it possible to stop a set of tests against a single parameter.
@RunWith(Parameterized.class)
public class Test{
public Test(String a, String b){
if(!a.equals(b)){
// Stop do not run tests
} // else go on run tests
}
}
@Parameters
public static Collection<Object[]> getParams(){
return Array.asList(new Object[][]{ {"aa","aa"},{"aa","bb"} };
}
@Test
public void test1(){ assertTrue(false); }
Did not test the code above just to give an idea what I am trying to accomplish. The constructor is actually trying to gain resources and if a resource fails to be acquired I do not want the tests to be attempted.
Thank you
You can move your logic into
getParams()method, so if you can’t “gain resources” there, you can simply return an empty collection of parameters, so nothing to run.