我使用assert语句使测试用例失败,但是我需要在第一次断言失败后继续其他断言语句。为此,我开始了解将使用Collector类。我现在需要将assert语句转换为checkThat()方法。 以下断言语句将转换为collector.checkThat()方法。
有人可以帮助我吗?
assertTrue("Login failure",
(SeleniumClass.waitUntilElementVisible(webDriver, By.xpath(".//*
[@id='xyz']"))));
答案 0 :(得分:0)
您可以使用Hamcrest CoreMatchers。
import static org.hamcrest.CoreMatchers.is;
collector.checkThat(
"Login failure",
SeleniumClass.waitUntilElementVisible(
webDriver, By.xpath(".//*[@id='xyz']")
),
is(true)
)