使用 RetryAnalyzer 运行失败的测试 - 使用数据提供程序的测试未按预期工作 [英] Running failed test using RetryAnalyzer - not working as expected for test using data provider
问题描述
我使用 IRetryAnalyzer 来运行失败的测试用例,并使用 IAnnotationTransformer 在运行时设置注释.对于使用数据提供程序的@Test,它给出了奇怪的结果.
I am using IRetryAnalyzer for running failed test cases and using IAnnotationTransformer for setting annotation at run time. For @Test using data provider its giving strange result.
我设置了重试限制 3,即测试应该重新运行 3 次.问题是:如果第一个数据集的测试失败,则重试 3 次(如预期).然后对于所有剩余的数据集 - 重新运行计数为 2.我不确定,是 2 次重试还是 1 次运行 1 次重试.
I have set retry limit 3, that is test should re-run 3 times. Issue is : If test fails for first data set, then it retries 3 times (as expected). Then for all remaining data set - re-run count is 2. I am not sure, its 2 retries or its 1 run 1 retry.
这是实现数据提供者的类:
Here is class implementing data provider:
@Test(dataProvider = "data-source")
public void toolbarActionsOnShapes(String selectShape)
throws InterruptedException {
Assert.assertTrue(false);
}
@DataProvider(name = "data-source")
public Object[][] allShapes() {
return new Object[][] { { "Rectangle" }, { "Circle" }, { "Triangle" }
};
}
}
运行这个我得到输出:https://drive.google.com/open?id=1FxercluPinPiOOUAZKe_dMa6NvVMCE0j
对于每组数据,如果测试失败 - 应该重试 3 次.附上虚拟项目 zip 以供参考.https://drive.google.com/open?id=1Mt7V2TO4TWRKU9dN4FIFzprkDingUKaE谢谢!!
For every set of data, if test fails - there should be 3 retries. Dummy project zip is attached for reference. https://drive.google.com/open?id=1Mt7V2TO4TWRKU9dN4FIFzprkDingUKaE Thanks !!
推荐答案
这是由于 TestNG 7.0.0-beta1
中存在的错误.有关详细信息,请参阅 GITHUB-1946.
This is due to a bug that exists in TestNG 7.0.0-beta1
. Please see GITHUB-1946 for more details.
我继续将其修复为我的拉取请求的一部分 PR-1948
I went ahead and fixed this as part of my pull request PR-1948
请使用 TestNG 7.0.0-SNAPSHOT
来解决这个问题.这应该是即将发布的 TestNG 7.0.0-beta2
(或)7.0.0
(最终版本)的一部分.这部分还没有决定.
Please make use of TestNG 7.0.0-SNAPSHOT
to get past this problem. This should be part of the upcoming TestNG 7.0.0-beta2
(or) 7.0.0
(final release). Its not decided on this part yet.
这篇关于使用 RetryAnalyzer 运行失败的测试 - 使用数据提供程序的测试未按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!