Automated tests 扩展测试报告V3(junit4)-通过将1个类下的测试用例附加到唯一报告中进行故障排除
我在将测试附加到测试报告中时遇到问题。我只想做最基本的步骤,所以我写了4TC。当我运行它们并打开报告时,每次它们在报告中重复时。 我使用的是数据块报告版本3和Junit4,我遵循了他们网站上的文档。 有人能帮我解决这个问题,并了解如何为一个类下的所有tc创建正确的报告吗?对于附加测试用例,我使用命令Automated tests 扩展测试报告V3(junit4)-通过将1个类下的测试用例附加到唯一报告中进行故障排除,automated-tests,junit4,qa,extentreports,selenium-extent-report,Automated Tests,Junit4,Qa,Extentreports,Selenium Extent Report,我在将测试附加到测试报告中时遇到问题。我只想做最基本的步骤,所以我写了4TC。当我运行它们并打开报告时,每次它们在报告中重复时。 我使用的是数据块报告版本3和Junit4,我遵循了他们网站上的文档。 有人能帮我解决这个问题,并了解如何为一个类下的所有tc创建正确的报告吗?对于附加测试用例,我使用命令htmlReporter.setAppendExisting(true)。 这是我的代码: public class ExtentReport3 { @Test public vo
htmlReporter.setAppendExisting(true)代码>。
这是我的代码:
public class ExtentReport3 {
@Test
public void OpenaAccount() throws Exception{
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("./src/TestExtent3.html");
htmlReporter.setAppendExisting(true);
// create ExtentReports and attach reporter(s)
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// creates a toggle for the given test, adds all log events under it
ExtentTest test = extent.createTest("4.Open account test", "Sample description");
// log(Status, details)
test.log(Status.INFO, "Step 1");
test.log(Status.INFO, "Step 2");
extent.flush();
}
@Test
public void LoginForm () throws Exception{
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("./src/TestExtent3.html");
htmlReporter.setAppendExisting(true);
// create ExtentReports and attach reporter(s)
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// creates a toggle for the given test, adds all log events under it
ExtentTest test1 = extent.createTest("3.Login form", "Sample description");
// log(Status, details)
test1.log(Status.INFO, "Step 1");
test1.log(Status.INFO, "Step 2");
extent.flush();
}
@Test
public void CheckOutForm() throws Exception{
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("./src/TestExtent3.html");
htmlReporter.setAppendExisting(true);
// create ExtentReports and attach reporter(s)
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// creates a toggle for the given test, adds all log events under it
ExtentTest test2 = extent.createTest("1.Checkout form", "Sample description");
// log(Status, details)
test2.log(Status.INFO, "Step 1");
test2.log(Status.INFO, "Step 2");
extent.flush();
}
@Test
public void CancelOredr() throws Exception{
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("./src/TestExtent3.html");
htmlReporter.setAppendExisting(true);
// create ExtentReports and attach reporter(s)
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
// creates a toggle for the given test, adds all log events under it
ExtentTest test3 = extent.createTest("2.Cancel order", "Sample description");
// log(Status, details)
test3.log(Status.INFO, "Step 1");
test3.log(Status.INFO, "Step 2");
extent.flush();
}
}