Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java/cucumber报告未使用MasterThink生成报告_Java_Maven_Cucumber - Fatal编程技术网

Java/cucumber报告未使用MasterThink生成报告

Java/cucumber报告未使用MasterThink生成报告,java,maven,cucumber,Java,Maven,Cucumber,我一直在尝试整合MasterThinkmaven——cucumber reporting,这样我就可以像广告中所宣传的那样,制作出关于Jenkins的漂亮报告。 我在多个网站上遵循了配置说明,包括damienfremont.com的帖子,但我的实现没有生成任何报告。 StackOverflow上的类似帖子没有给出答案 CucumberTestRunner.java @RunWith(Cucumber.class) @CucumberOptions( glue = "xxx.yyy.

我一直在尝试整合MasterThink
maven——cucumber reporting
,这样我就可以像广告中所宣传的那样,制作出关于Jenkins的漂亮报告。 我在多个网站上遵循了配置说明,包括damienfremont.com的帖子,但我的实现没有生成任何报告。 StackOverflow上的类似帖子没有给出答案

CucumberTestRunner.java

@RunWith(Cucumber.class)
@CucumberOptions(
  glue = "xxx.yyy.zzz.cucumber",
  features = "src/test/resources/features",
  snippets = SnippetType.CAMELCASE,
  tags = {"@aaa", "@bbb"},
  plugin = {"json:target/cucumber.json", "html:target/site/cucumber-pretty"}
  )
public class CucumberTestRunner {}
pom.xml


黄瓜
黄瓜爪哇
4.2.0
黄瓜
黄瓜刺柏
4.2.0
网络智囊团
黄瓜报道
4.4.0
其他依赖项-Spring、数据库、日志等
org.apache.maven.plugins
maven编译器插件
3.7.0
1.8
1.8
org.codehaus.mojo
execmaven插件
1.5.0      
集成测试
JAVA
测试
cumber.api.cli.Main
--gluexxx.yyy.zzz.cumber
--鸡皮疙瘩
--pluginhtml:target/cucumber.html
src/测试/资源
org.apache.maven.plugins
maven surefire插件
2.21.0
真的
网络智囊团
maven——黄瓜报道
4.4.0      
执行
验证
生成
执行器报告
${project.build.directory}/site/cucumber报告
${project.build.directory}/project
cumber.api.cli.Main
结果: 从intelliJ运行CucumberTestRunner.java会创建target/cucumber.json和target/site/cucumber pretty/index.html等

运行
mvn verify-Dcucumber.options=“--tags@aaa--tags@bbb”
创建
target/cucumber.html/index.html
等(如pom中规定)

所以本地的surefire报告正在制作中,但我没有得到主旨输出

当我通过Jenkins运行
mvn构建时,安装了
cucumber reports.hfi
插件,我得到了
“net.masterthink.cucumber.ValidationException:Nonereport
文件已添加!”这很有意义,因为mvn作业没有生成reports.password


我已经查看了其他StackOverflow问题,但看不出我的代码有什么问题。非常感谢您的帮助。

我也遇到了同样的错误。然后我使用了下面的代码,而不是使用pom.xmlnet.masterthink插件。它工作并生成了报告。 但是,我使用的是TestNG。因此,您必须使用注释后的
@检查它是否适用于JUnit

    @AfterSuite
    public void generateReport() {
    File reportOutputDirectory = new File("target"); //
    List<String> jsonFiles = new ArrayList<String>();
    jsonFiles.add("target/cucumber.json");
    String projectName = "Your Sample Project Name";
    String buildNumber = "1.0";

    Configuration configuration = new Configuration(reportOutputDirectory, 
    projectName);

    configuration.setRunWithJenkins(true);
    configuration.setBuildNumber(buildNumber);

    ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
    reportBuilder.generateReports();
}
@AfterSuite
公共无效生成器报告(){
File reportOutputDirectory=新文件(“目标”)//
List jsonFiles=new ArrayList();
添加(“target/cumber.json”);
String projectName=“您的示例项目名称”;
字符串buildNumber=“1.0”;
配置=新配置(reportOutputDirectory,
项目名称);
setRunWithJenkins(true);
配置.setBuildNumber(buildNumber);
ReportBuilder ReportBuilder=新的ReportBuilder(JSonfile,配置);
reportBuilder.generateReports();
}

问题分类:在
pom.xml
execmaven插件中,我需要
json:${project.build.directory}/somewhere/for/reports的插件参数

fluffy Jenkins报告需要json文件。还需要确保Jenkins Cucumber reports配置中指定的目录与pom.xml文件中指定的目录一致


不需要
net.masterthink插件

如何为此添加插件参数。请给出POM.xml中必须包含的语句,好吗?
    @AfterSuite
    public void generateReport() {
    File reportOutputDirectory = new File("target"); //
    List<String> jsonFiles = new ArrayList<String>();
    jsonFiles.add("target/cucumber.json");
    String projectName = "Your Sample Project Name";
    String buildNumber = "1.0";

    Configuration configuration = new Configuration(reportOutputDirectory, 
    projectName);

    configuration.setRunWithJenkins(true);
    configuration.setBuildNumber(buildNumber);

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