我在TestNG中的Priority批注中遇到一些问题,无法运行测试用例。我的优先级数字不是连续的,我有意跳过了这些数字,因此将来可以在它们之间添加一些测试方法,以便按特定顺序运行。有什么想法可以让TestNG执行遵循数字鸿沟的测试方法吗?例如,我的优先级为1-3,然后跳到200-202。优先级为200-202的测试未执行。感谢您的宝贵时间。
public class ClassOneTest{
@Test (enabled=true, priority=1)
public void methodOneTest() {
.....
}
/**
* Updates the ServiceNow End Point
*/
@Test (enabled=true, priority=2)
public void methodTwoTest() {
.....
}
/**
* Deletes the ServiceNow End Point
*/
@Test (enabled=true, priority=3)
public void methodTwoTest() {
.....
}
}
public class ClassTwoTest{
@Test (enabled=true, priority=200)
public void methodThreeTest() {
.....
}
/**
* Updates the ServiceNow End Point
*/
@Test (enabled=true, priority=201)
public void methodFourTest() {
.....
}
/**
* Deletes the ServiceNow End Point
*/
@Test (enabled=true, priority=202)
public void methodFiveTest() {
.....
}
}
答案 0 :(得分:0)
我发现了问题。具有200优先级的班级已在优先级较低的班级中加载到套件中。一旦更改了加载顺序,它就可以正常工作。