鉴于我有以下课程(有关并行运行的更多信息,请参见Parallelized Runner ):
@RunWith(Parallelized.class)
public class TopicTest {
String topic;
public TopicTest(String topic) {
this.topic = topic;
}
@Test
public void testTopicPage() {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.mysite.com/topics/" + topic + "/");
TopicPage topicPage = PageFactory.initElements(driver, TopicPage.class);
Assert.assertTrue("No items were located on this topic page <" + topic + ">", topicPage.elementsFound());
driver.quit();
}
@Parameters
public static Collection<Object []> topics() {
List<Object []> parameters = new ArrayList<Object []>();
for(String s : new String [] { "topic1", "topic2", "invalidTopic" }) {
parameters.add(new Object [] { s });
}
return parameters;
}
public static class TopicPage {
@FindBy(className = "result-set-a")
private List<WebElement> items;
public boolean elementsFound() {
return items != null && items.size() > 0;
}
}
}
无论如何,除了通过/失败状态之外,我还能从我的测试运行中获得更多信息吗?由于断言错误,我可以获得以下有关我失败的运行的信息:
junit.framework.AssertionFailedError: No recipes were located on this topic page <invalidTopic>
有没有一种方法可以让我从我们通过的测试中获取更多信息以用于报告目的?