Allure Cucumber Maven 报告问题

huangapple go评论92阅读模式
英文:

Allure Cucumber Maven Reports Issues

问题

<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>
    </exclusions>
</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>
英文:

I'm trying to get my test reports working with Allure, but when I'm building I'm getting the below error:

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

I followed their instructions here https://docs.qameta.io/allure/#_cucumber_jvm

I'm not sure what it means when it says it's based on cucumber-jvm version and does it matter if I'm using cucumber-jvm-dep?

&lt;properties&gt;
    &lt;aspectj.version&gt;1.8.10&lt;/aspectj.version&gt;
&lt;/properties&gt;

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

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

答案1

得分: 0

看起来您忘记将这个模块添加到 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>
英文:

Looks like you forgot to add such module into pom.xml

 &lt;systemPropertyVariables&gt;
     &lt;allure.results.directory&gt;target/allure-results&lt;/allure.results.directory&gt;
&lt;/systemPropertyVariables&gt;

My configuration look like this

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

&lt;/configuration&gt;

huangapple
  • 本文由 发表于 2020年10月7日 04:15:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/64233212.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定