【发布时间】:2020-06-03 06:41:25
【问题描述】:
我想在 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);
}
【问题讨论】:
标签: java unit-testing testing testng