gpt4 book ai didi

java - 我们可以在 TestNG 中将两个注释(IRetryAnalyzer 和优先级)类型作为一个类型传递吗

转载 作者:行者123 更新时间:2023-11-28 21:24:22 25 4
gpt4 key购买 nike

以测试用例为例,我有一种情况想同时使用 IRetryAnalyzer 和优先级。我想对单个测试用例使用/应用以下两个参数

@Test(retryAnalyzer = test1.Retry.class)
@Test(priority=0)

例子:-

@Test(retryAnalyzer = test1.Retry.class)
@Test(priority=0)
public void Test1()
{
System.out.println("Retry attempt");
i++;
System.out.println("value of i ="+i);
if(i<2)
{
System.out.println("I m in fail Fail");
Assert.assertEquals(false, true);
}
if(i>=2) {
System.out.println("I m in fail pass");
Assert.assertEquals(false, false);
}
}

enter image description here

有什么方法可以将两者都应用于单个测试用例。

最佳答案

将两个值合并到一个 Test 注释中。

@Test(retryAnalyzer = test1.Retry.class, priority=0)
public void Test1()

关于java - 我们可以在 TestNG 中将两个注释(IRetryAnalyzer 和优先级)类型作为一个类型传递吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44386980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com