来自eclipse的Maven cubber报告未根据此插件生成报告

x33g5p2x  于 2022-11-02  发布在  Maven
关注(0)|答案(4)|浏览(223)

尝试根据maven cubper报告Link to maven cucumber reporting生成报告
在pom.xml文件中进行了必要的更改,如此处所述tutorial on configuring reports
但是,报告是在简单的html文件中生成的,而不是按照cubber报告。
pom.xml

<pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.${java.version}</source>
                        <target>1.${java.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.20</version>
                    <configuration>
                        <!-- <testFailureIgnore>true</testFailureIgnore> -->
                        <includes>
                            <exclude>**/*RunCukesTest.java</exclude>
                            <!-- <include>**/*RunCukesTest.java</include> -->
                        </includes>
                        <!-- <excludes> <exclude>**/*RunCukesTest.java</exclude> </excludes> -->
                    </configuration>
                </plugin>
                <!-- This is for Cucumber Custom Report plug in we specify the configuration 
                    details under configuration tag. -->
                <!-- http://startingwithseleniumwebdriver.blogspot.com/2016/05/custom-cucumber-reporting-using-maven.html -->
                 <plugin>
                    <groupId>net.masterthought</groupId>
                    <artifactId>maven-cucumber-reporting</artifactId>
                    <version>3.11.0</version>
                    <executions>
                        <execution>
                            <id>execution</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>
                                <projectName>CucumberReport</projectName>
                                <outputDirectory>${project.build.directory}/site/cucumber-reports</outputDirectory>
                                <!-- <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput> -->
                                <jsonFiles>
                                    <param>${project.build.directory}/cucumber.json</param>
                                </jsonFiles>
                                <!-- <parallelTesting>false</parallelTesting> -->
                                <buildNumber>1</buildNumber>
                                <checkBuildResult>false</checkBuildResult>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

RunCukesTest.java

@RunWith(Cucumber.class)
@CucumberOptions(
        features = {"classpath:features"},
        plugin = {"html:target/site/cucumber-pretty","json:target/cucumber.json"},
        tags = {"@currentTest"},
        glue={"helpers","stepDefinitions"},
        monochrome = true
        )
public class RunCukesTest{

}

生成如下报告

与预期的

不同

puruo6ea

puruo6ea1#

POM.xml文件:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
         <configuration>
            <testFailureIgnore>true</testFailureIgnore>
            <includes>
            <include>**/TestRunner.java</include>
            </includes>
         </configuration>
     </plugin>

   <plugin>
  <groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.5.0</version>
  <executions>
  <execution>
  <id>execution</id>
  <phase>test</phase>
<goals>
 <goal>generate</goal>
 </goals>
<configuration>
<!--   <projectName>imademethink_cucumber_advanced_reporting</projectName>  -->
 <outputDirectory>${project.build.directory}/site/cucumber-reports-advanced</outputDirectory>
 <cucumberOutput>${project.build.directory}/cucumber/cucumber.json</cucumberOutput>
 <skippedFails>true</skippedFails>
 <enableFlashCharts>false</enableFlashCharts>
<!--  <buildNumber>885</buildNumber> --> 
<buildNumber>8.4.1.2</buildNumber>
 </configuration>
</execution>
</executions>
</plugin>        


 </plugins>
 </build>
tjvv9vkg

tjvv9vkg2#

您需要设置如下标志

<checkBuildResult>true</checkBuildResult>

在下面的问题URL中查找我的答案
在Maven Cucumber Reports中构建失败时,不会生成报告

xzlaal3s

xzlaal3s3#

只要做两个改变,就可以了
1.从pom. xml文件中删除标记。
1.明确提供maven-surefire-plugin的版本。例如:版本:2.22.1

相关问题