我想在Table.getTables()第一次返回应该包含20个项目的表的列表下运行2次(或多次)的测试,但是当第二次运行测试时,它将不返回任何项目。因此,我想检查它是否第一次运行,然后检查它是否有20个项目,如果它是第二次运行,我想检查它是否不包含任何项目。我认为invocationCount对我不起作用。请看下面。谢谢
Java 8和TestNG 6.14。
//Run this test twice
@Test
public void repeatTest() {
List<String> tables = Table.getTables();
//if it is 1st run then check this
Assert.assertEquals(tables.size(), 20);
//if it is second run then check this
Assert.assertEquals(tables.size(), 0);
}
您可以拨打两次: