我有像身体一样的测试方法
{
assertTrue("Login failed", somecondition);
assertTrue("Page not browsing", somecondition);
assertTrue("Button not found", somecondition);
//here I want to found whether any assertTrue failed or all are passed
}
我怎样才能做到这一点?
答案 0 :(得分:2)
嗯,我不确定我理解,但这样的事情会起作用
assertTrue("are my conditions true? {}",condition1 && condition2 && condition3)
答案 1 :(得分:0)
如果您已经到达
行//here I want to found whether any assertTrue failed or all are passed
然后你肯定知道你已经传递了所有的assertTrue语句。
答案 2 :(得分:0)
您必须使用'assertTrue'方法记录JUnit报告中的条目,并使用您自己的变量来计算您想要的内容
{
allPassed = True;
assertTrue("Login failed", somecondition);
allPassed = allPassed && somecondition;
assertTrue("Page not browsing", somecondition);
allPassed = allPassed && somecondition;
// ...
assertTrue("All tests succeeded", allPassed);
}