首页 > 解决方案 > 无法在黄瓜报告中运行 3rd 方插件?

问题描述

我无法使用该 3rd 方插件,如果删除该插件并单击运行它运行没有错误但不生成 html 报告。我需要为 Spring Boot API 生成黄瓜报告,我添加了所有依赖项但仍然显示相同的错误,我在官方黄瓜报告页面中使用了黄瓜报告文档。

跑步者代码:

package com.example.demo.cucumberReport;


import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import io.cucumber.spring.CucumberContextConfiguration;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(plugin={"de.monochromata.cucumber.report.PrettyReports:target/cucumber" },
features = "src/test/java/com/example/demo/cucumberReport")
@CucumberContextConfiguration
public class runTest {


}

这是跑步者文件,

POM XML:

    <plugin>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>2.8.0</version>
        <executions>
            <execution>
                <id>execution</id>
                <phase>verify</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <projectName>Execution</projectName>
                    <outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
                    <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
                </configuration>
            </execution>
        </executions>
    </plugin>

这是 pom.xml 文件

错误:

java.lang.IllegalArgumentException: The plugin specification 'de.monochromata.cucumber.report.PrettyReports:' has a problem:

Could not load plugin class 'de.monochromata.cucumber.report.PrettyReports:/target/cucumber'.

Plugin specifications should have the format of PLUGIN[:[PATH|[URI [OPTIONS]]]

Valid values for PLUGIN are: default_summary, html, json, junit, message, null_summary, pretty, progress, rerun, summary, teamcity, testng, timeline, unused, usage

PLUGIN can also be a fully qualified class name, allowing registration of 3rd party plugins. The 3rd party plugin must implement io.cucumber.plugin.Plugin

我收到此错误。

标签: javamavenjunitcucumber

解决方案


您需要添加单色依赖项,而不是原来的 masterthought 依赖项。

<dependency>
  <groupId>de.monochromata.cucumber</groupId>
  <artifactId>reporting-plugin</artifactId>
  <version>4.0.98</version>
</dependency>

参考:https ://gitlab.com/monochromata-de/cucumber-reporting-plugin


推荐阅读