如何生成Klov报告

时间:2018-05-03 05:18:44

标签: java extentreports

我一直在尝试使用Klov生成报告并且是新手。首先,我安装了MongoDb 3.2并在cmd中初始化它,然后在我的项目中添加了Klov 0.1.0 jar和Mongo-java-driver-3.4.3 jar。当我运行我的项目时,连接已初始化并生成了Htmlreporter,但我无法在任何地方找到Klov报告。

我已经在cmd中初始化了MongoDb: I have initialized the MongoDb in the cmd

这里是代码:

htmlReporter = new ExtentHtmlReporter("TestReport.html");
    htmlReporter.setAppendExisting(true);
    klov = new KlovReporter();
    report = new ExtentReports();

    klov.initMongoDbConnection("localhost", 27017);

    klov.setProjectName("MyKlov");

    klov.setReportName("Build " + date.toString());

    klov.setKlovUrl("http://localhost");
    report.attachReporter(htmlReporter, klov);
    report.setSystemInfo("OS", "Windows");
    report.setSystemInfo("Host Name", "XXX");
    report.setSystemInfo("Environment", "QA");
    report.setSystemInfo("User Name", "XXXXXXX");

    htmlReporter.config().setChartVisibilityOnOpen(true);
    htmlReporter.config().setDocumentTitle(" Automation Testing");
    htmlReporter.config().setReportName("Automation Test Report");
    htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
    htmlReporter.config().setTheme(Theme.STANDARD);

    logger = report.createTest("ROF");

运行代码后,它会在cmd中显示一些值: After running the code, it shows some values in the cmd

生成Klov报告的实际步骤是什么?

1 个答案:

答案 0 :(得分:1)

            extent = new ExtentReports();
            KlovReporter klovReporter = new KlovReporter();
            klovReporter.initMongoDbConnection("yourIPaddress", 27017);
            klovReporter.setProjectName("My project");
            klovReporter.setReportName("reportName");
            klovReporter.setKlovUrl("http://yourIPaddress");
            extent.attachReporter(klovReporter);

开始:  -MongoDB 3.2 cmd  -在cmd中运行Klov jar

使用浏览器对http://localhost或您的IP地址进行计数。