忽略测试用例中的断言失败(JUnit) [英] Ignore Assertion failure in a testcase (JUnit)
本文介绍了忽略测试用例中的断言失败(JUnit)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,我正在使用Java和Selenium rc编写自动化测试.
Currently, I am writing the automation testing using java and selenium rc.
我想验证用户界面上显示的所有内容,功能如下:
I would like to verify all the contents present on the user interface, the function is ie below:
public String UITest() throws IOException {
String result="Test Start<br />";
try {
openfile(1);
for (String url : uiMaps.keySet()) {
selenium.open(url);
for (String item : uiMaps.get(url)) {
assertEquals(url+" check: " + item, true,selenium.isTextPresent(item));
result+=url+" check: " + item+" : OK<br />";
}
}
} catch (AssertionError e) {
result+=e.getMessage();
}
result+="Test finished<br />";
return result;
}
该函数假定返回一个String,其中包含有关测试的信息.但是,一旦发生断言错误,函数就会停止.
the function suppose return a String contains information about the testing. However, the function stopped once there is an assertion error happened.
因此,我想知道是否存在一种忽略故障并继续执行所有断言验证的方法.
So, I want to know whether there is a way to ignore the failure and keep executing all the assertion verifications.
感谢您的帮助
推荐答案
查看全文