问题描述
这是我的范围报告class
:
public class ExtentReport {
public static ExtentHtmlReporter extentHtmlReporter;
public static ExtentReports extentReports;
public static ExtentTest extentTest;
public static void init() throws Exception {
extentHtmlReporter = new ExtentHtmlReporter(getLocalLocation());
extentReports = new ExtentReports();
extentReports.attachReporter(extentHtmlReporter);
}
private static String getLocalLocation() throws Exception {
String location = "";
switch (OsCheck.getoperatingSystemType()) {
case Windows:
location = ".\\reports\\report.html";
break;
case Mac:
location = "./reports/report.html";
break;
case Linux:
location = "./reports/report.html";
break;
}
return location;
}
}
测试class
:
public class TestClass {
@Before
public void setup() throws Exception {
ExtentReport.init();
ExtentReport.extentTest = ExtentReport.extentReports.createTest("Setup");
}
@After
public void cleanup() {
ExtentReport.extentTest = ExtentReport.extentReports.createTest("Cleanup","Clean system");
ExtentReport.extentReports.flush();
}
@Test
public void test1(){
ExtentReport.extentTest = ExtentReport.extentReports.createTest("test1");
Assert.assertEquals(1,1);
}
@Test
public void test2(){
ExtentReport.extentTest = ExtentReport.extentReports.createTest("test2");
Assert.assertEquals(1,1);
}
@Test
public void test3(){
ExtentReport.extentTest = ExtentReport.extentReports.createTest("test3");
Assert.assertEquals(1,1);
}
}
在我的报告中,我只能看到上次运行的测试。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)