在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");
}
我在我的代码中使用了TestNG软断言。
public class AssertionTest{
private SoftAssert softAssert = new SoftAssert();
@Test(enabled = true)
public void testSoftAssertion(){
softAssert.assertTrue(false);
softAssert.assertTrue(true);
softAssert.assertEquals("India", "US
我在一次面试中被问到这个问题。我回答这个问题,因为第一次考试会失败,第二次考试会通过。但是当我在intelliJ上运行的时候,我想到了我的超奖。我可以看出两者都失败了。
对于第二个测试,期望值显示为“值”。不知道为什么吗?
import org.testng.annotations.Test;
import org.testng.annotations.SoftAssert;
public class SoftAssertion{
SoftAssert softAssert = new SoftAssert();
@Test
public void first(){
softAsser