http://www.techwars.io/fight/testng/junit4/
http://www.mkyong.com/unittest/junit-4-vs-testng-comparison/
1. @BeforeClass в Junit static
2. Неудобное использование @DataProvider
3. Порядок выполнения
Использование @DataProvider в Junit с либой junit-dataprovider
junit
junit
1.4.12 test
com.tngtech.java
junit-dataprovider
1.9.2 test
@RunWith(DataProviderRunner.class)
public class DataProviderTest {
@DataProvider
public static Object[][] dataProviderAdd() {
return new Object[][] {
{ 0, 0, 0 },
{ 1, 1, 2 },
};
}
@Test
@UseDataProvider("dataProviderAdd")
public void testAdd(int a, int b, int expected) {
int result = a + b;
assertEquals(expected, result);
}
}