我正在使用迭代器运行搜索并使用TestNG Assert.assertFail
进行断言。
我使用try{}catch{}
机制处理代码,以确保在断言失败时测试不会中断。但是我发现在断言失败的情况下代码中断了,我正在寻找一种方法,WebDriver应该在失败的情况下使用迭代器列表中的下一条记录进行搜索。请帮助......
while (countryListiterator.hasNext()) {
Thread.sleep(2500);
countryListiteratorNextVAL = countryListiterator.next();
searchResultPO toSearchpage = homeTosearch
.search(countryListiteratorNextVAL);
// Do an Assertion here, if fails the test-ng class breaks without going to the next record.
Assert.assertFalse(boolean condition)
}
答案 0 :(得分:0)
按照设计,它会失败/破坏。您必须通过链接(http://beust.com/weblog/2012/07/29/reinventing-assertions/)
重新发明断言