Kamal ALLALI
Kamal ALLALI

Reputation: 49

Ignore a junit test with parametrized test

I run parametrized test with Junit, but I want to skip some tests following a flag. The parameters are stored in a CSV file and when a flag is "off" I want to skip this test. How can I do this?

Upvotes: 0

Views: 1247

Answers (1)

Stefan Birkner
Stefan Birkner

Reputation: 24540

You can use the Assume class.

@Test
public void something() throws Exception {
    Assume.assumeFalse(valueFromCsv.equals("off"));
}

The test will be skipped by JUnit if the assumption is not fulfilled.

Upvotes: 3

Related Questions