使用范围报告设置 Klov

Setting up Klov with Extent Reports

我第一次尝试在一个新项目中设置 Klov。我已经安装了正确版本的 mongodb 并拥有 klov jar。我 运行 在 运行 我的测试之前都在 cmd 中。当我在浏览器中查看我的 Klov 报告时,除了 "select your project:" 下拉列表中没有列出任何项目之外,一切似乎都正常工作。有谁知道为什么我可能会遇到这个错误?

public class MyRunner {

private static KlovReporter klov;
private static ExtentReports extent;
private static Date d;
private static ExtentHtmlReporter htmlReporter;

@BeforeClass
public static void initialize(){
    d = new Date();
    extent = new ExtentReports();
    klov = new KlovReporter();
    htmlReporter = new ExtentHtmlReporter("ExtentReport.html");

    htmlReporter.setAppendExisting(true);
    htmlReporter.config().setChartVisibilityOnOpen(true);
    htmlReporter.config().setDocumentTitle("Klov Example");
    htmlReporter.config().setReportName("Test");
    htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
    htmlReporter.config().setTheme(Theme.STANDARD);

    klov.initMongoDbConnection("localhost",27017);
    klov.setProjectName("klovexample");
    klov.setReportName("Test" + d.toString());
    klov.setKlovUrl("http://localhost:80");

    extent.attachReporter(htmlReporter, klov);

    extent.createTest("ROF");
}

@AfterClass
public static void teardown(){
    klov.flush();
}

使用

extent.flush();

而不是

klov.flush();

另外加个日志小哥:

extent.createTest("ROF").pass("log");