由于失败绕过@Test dependsOnMethods
bypassing @Test dependsOnMethods due to failure
我有一个关于@Test(dependOnMethods{""}) 的问题..
我希望我的测试以特定的顺序 运行 进行,因此我完成了我编写的每个测试。到目前为止,至少我发现的最好的方法是 dependsOnMethods!但是,由于后面的测试需要之前的测试通过,所以我无法 运行 我的所有测试并查看哪些测试失败了。我的程序刚刚退出!所以这就是我正在使用的..
@Test(dependsOnMethods = {"shouldSelectAmountOfDoors"})
public void shouldSelectExtColor() throws InterruptedException{
sycOptionalInfoPage.selectExtColor("GREEN");
}
@Test(dependsOnMethods = {"shouldSelectExtColor"})
public void shouldSelectIntColor() throws InterruptedException{
sycOptionalInfoPage.selectIntColor("GOLD");
}
@Test(dependsOnMethods = {"shouldSelectIntColor"})
public void shouldEnterAComment() throws InterruptedException{
sycOptionalInfoPage.enterComments("<(*-<) <(*-*)> (>-*)> woot!");
takeABreakYo();
}
繁荣。非常容易理解和值得信赖的 POM!但是,如果我的 shouldSelectIntColor() 由于开发团队更改了 id 而失败,我希望 shouldEnterAComment 仍然 运行!我怎样才能继续将我的测试链接成一行,但在失败后仍然 运行?谢谢:)
您可以使用 priority
而不是 dependsOnMethods
来实现您想要的:
@Test(priority = 1)
public void shouldSelectIntColor() throws InterruptedException{
}
@Test(priority = 2)
public void shouldEnterAComment() throws InterruptedException{
}
这里如果你的shouldSelectIntColor
方法失败了,它仍然会执行shouldEnterAComment
测试方法。
您可以使用提到的优先级,也可以使用 run-always=true
。它被称为软依赖。这样,即使之前的方法失败,您的方法仍然 运行 。
我有一个关于@Test(dependOnMethods{""}) 的问题.. 我希望我的测试以特定的顺序 运行 进行,因此我完成了我编写的每个测试。到目前为止,至少我发现的最好的方法是 dependsOnMethods!但是,由于后面的测试需要之前的测试通过,所以我无法 运行 我的所有测试并查看哪些测试失败了。我的程序刚刚退出!所以这就是我正在使用的..
@Test(dependsOnMethods = {"shouldSelectAmountOfDoors"})
public void shouldSelectExtColor() throws InterruptedException{
sycOptionalInfoPage.selectExtColor("GREEN");
}
@Test(dependsOnMethods = {"shouldSelectExtColor"})
public void shouldSelectIntColor() throws InterruptedException{
sycOptionalInfoPage.selectIntColor("GOLD");
}
@Test(dependsOnMethods = {"shouldSelectIntColor"})
public void shouldEnterAComment() throws InterruptedException{
sycOptionalInfoPage.enterComments("<(*-<) <(*-*)> (>-*)> woot!");
takeABreakYo();
}
繁荣。非常容易理解和值得信赖的 POM!但是,如果我的 shouldSelectIntColor() 由于开发团队更改了 id 而失败,我希望 shouldEnterAComment 仍然 运行!我怎样才能继续将我的测试链接成一行,但在失败后仍然 运行?谢谢:)
您可以使用 priority
而不是 dependsOnMethods
来实现您想要的:
@Test(priority = 1)
public void shouldSelectIntColor() throws InterruptedException{
}
@Test(priority = 2)
public void shouldEnterAComment() throws InterruptedException{
}
这里如果你的shouldSelectIntColor
方法失败了,它仍然会执行shouldEnterAComment
测试方法。
您可以使用提到的优先级,也可以使用 run-always=true
。它被称为软依赖。这样,即使之前的方法失败,您的方法仍然 运行 。