如何将脚本标记为失败但不中止 Selenium 中当前测试用例的执行?
@Test
public void testCase() {
System.out.println("line 1 printed");
Assert.assertTrue(false);
System.out.println("i want to execute this line after failure");
}
最佳答案
使用test-ng
SoftAssert softAssert = new SoftAssert();
@Test
public void testCase() {
System.out.println("line 1 printed");
softAssert.assertTrue(true);
softAssert.assertEquals("India", "US");
softAssert.assertTrue(false);
System.out.println("i want to execute this line after failure");
softAssert.assertAll();
}
<小时/>
我怀疑junit
仍然没有提供这样的功能。
关于java - 如何将脚本标记为失败但不中止 Selenium 中当前测试用例的执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37675245/