DataProvider support in the IntelliJ IDEA TestNG Plugin
testing framework testng java
It's not likely to make it into TestNG 5.3 but I've added a slight patch to the IDE integration protocol to provide support for DataProvider's in the IntelliJ IDEA plugin.
One of the more innovative features of the TestNG testing framework are DataProvider's. A DataProvider is a test configuration method which, as the name suggests - provides data to other test methods:
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class DataSourceTest {
@DataProvider(name = "test.data")
public static Object[][] data() {
return new Object[][]{
{"foo1"},
{"foo2"},
{"foo3"},
{"fail"},
{"foo4"},
{"foo5"}
};
}
@Test(dataProvider = "test.data")
public void test(String data) {
if (data.equals("fail")) Assert.fail("Fail");
}
}In the current plugin, only one test result will be shown for the method "test", and as the last piece of data provided by data() is valid, the test shows as a green pass - instead of 5 green passes and 1 red fail. With the patch applied we now see the following:

This should be available shortly after the 5.3 release as a 5.3.1 release with similar support provided in the Eclipse plugin.