构造函数ReportBuilder(List <string>,Configuration)未定义

时间:2016-11-18 09:07:37

标签: selenium cucumber

我在报告生成器脚本中收到错误&#34;构造函数ReportBuilder(List,Configuration)未定义&#34;在下面的代码行。

ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
reportBuilder.generateReports();

请参考我的完整代码:

import java.io.File;

import java.util.ArrayList;

import java.util.List;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;

import cucumber.api.SnippetType;

import cucumber.api.junit.Cucumber;

import net.masterthought.cucumber.Configuration;

import net.masterthought.cucumber.ReportBuilder;

import net.masterthought.cucumber.ReportParser;

public class GenerateReport {   

    public static void GenerateMasterthoughtReport(){
        try{
            //String RootDir = System.getProperty("user.dir");
            File reportOutputDirectory = new File("target/Masterthought");
            List<String> jsonFiles = new ArrayList<String>();
            jsonFiles.add("target/cucumber.json");
            //list.add("target/cucumber2.json");    

            String jenkinsBasePath = "";
            String buildNumber = "1";
            String projectName = "cucumber-jvm";
            boolean skippedFails = true;
            boolean pendingFails = false;
            boolean undefinedFails = true;
            boolean missingFails = true;
            boolean runWithJenkins = false;
            boolean parallelTesting = false;

            Configuration configuration = new Configuration(reportOutputDirectory, projectName);
            // optionally only if you need
            configuration.setStatusFlags(skippedFails, pendingFails, undefinedFails, missingFails);
            configuration.setParallelTesting(parallelTesting);
            configuration.setJenkinsBasePath(jenkinsBasePath);
            configuration.setRunWithJenkins(runWithJenkins);
            configuration.setBuildNumber(buildNumber);

           ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
           reportBuilder.generateReports();

        }catch(Exception e){
            e.printStackTrace();
        }
    }   

}

请提供宝贵的建议以使我的脚本有效。

1 个答案:

答案 0 :(得分:0)

根据cucumber-reports的最新版本viz

<dependency>
    <groupId>net.masterthought</groupId>
    <artifactId>cucumber-reporting</artifactId>
    <version>3.2.0</version>
</dependency>

构造函数public ReportBuilder(List<String> jsonFiles, Configuration configuration)存在。请检查您的依赖项/ CLASSPATH并确保使用的是正确的版本。

请参阅here