魅力黄瓜 Maven 报告问题

Allure Cucumber Maven Reports Issues

我正在尝试让我的测试报告与 Allure 一起使用,但在构建时出现以下错误:

Error: Could not find or load main class          -Dcucumber.options=---plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm

我在这里遵循了他们的指示https://docs.qameta.io/allure/#_cucumber_jvm

我不确定它说它基于 cucumber-jvm 版本是什么意思,如果我使用的是 cucumber-jvm-dep 有关系吗?

<properties>
    <aspectj.version>1.8.10</aspectj.version>
</properties>

<dependencies>
<dependency>
    <groupId>io.qameta.allure</groupId>
    <artifactId>allure-cucumber4-jvm</artifactId>
    <version>2.13.6</version>
</dependency>
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-jvm-deps</artifactId>
    <version>1.0.5</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.5</version>
</dependency>
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-testing</artifactId>
    <version>1.2.5</version>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </exclusion>
     <exclusion>
</dependency>
</dependencies>

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>testng.xml</suiteXmlFile>
            <testFailureIgnore>true</testFailureIgnore>
            <argLine>
                -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                -Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"
            </argLine>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
        </dependencies>
    </plugin>
</plugins>
</build>

看来您忘记将此类模块添加到 pom.xml

 <systemPropertyVariables>
     <allure.results.directory>target/allure-results</allure.results.directory>
</systemPropertyVariables>

我的配置是这样的

<configuration>
    
<includes>
  <exclude>**/CucumberJvmTest</exclude>
</includes>
        
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
</argLine>
        
<systemPropertyVariables>
    <allure.results.directory>target/allureresults</allure.results.directory>
</systemPropertyVariables>

</configuration>