当前位置: 首页 > 知识库问答 >
问题:

在maven中运行时不会生成Cucumber HTML报告

姚雅珺
2023-03-14

请找到我的pom.xml

4.0.0

<groupId>Cucumberreports</groupId>
<artifactId>Cucumberreports</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>Cucumberreports</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>6.11.0</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>6.11.0</version>
        <scope>test</scope>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>6.11.0</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
    <!-- https://mvnrepository.com/artifact/net.masterthought/maven-cucumber-reporting -->
    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>5.5.4</version>
    </dependency>



</dependencies>

<build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven 
            defaults (may be moved to parent pom) -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>
                        <include>**/CucumberRunner*.java</include>
                    </includes>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>

            </plugin>
            
            
            <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.5.4</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>Cucumberreports</projectName>
                        <!-- optional, per documentation set this to "true" to bypass generation of Cucumber Reports entirely, defaults to false if not specified -->
                        <skip>false</skip>
                        <!-- output directory for the generated report -->
                        <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <inputDirectory>target/cucumber-reports/cucumber.json</inputDirectory>
                        <jsonFiles>
                            <!-- supports wildcard or name pattern -->
                            <param>**/*.json</param>
                        </jsonFiles>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <classificationDirectory>${project.build.directory}/cucumber-reports</classificationDirectory>
                        <classificationFiles>
                                <!-- supports wildcard or name pattern -->
                                <param>sample.properties</param>
                                <param>other.properties</param>
                        </classificationFiles>
                        <parallelTesting>false</parallelTesting>
                        <!-- optional, set true to group features by its Ids -->
                        <mergeFeaturesById>false</mergeFeaturesById>
                        <!-- optional, set true to get a final report with latest results of the same test from different test runs -->
                        <mergeFeaturesWithRetest>false</mergeFeaturesWithRetest>
                        <!-- optional, set true to fail build on test failures -->
                        <checkBuildResult>false</checkBuildResult>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        </plugins>
    </pluginManagement>
</build>

@runwith(cucumber.class)@cucumberoptions(features={“c:\users\rishabh patel\eclipse-workspace\cucumberreports\feature”},glue={“stepdefinition”},plugin={“pretty”,“json:target/cucumber-reports/cucumber.json”}//monochrome=true

    )

公开课CucumberRunner{

}

共有1个答案

詹唯
2023-03-14

在runner类中包含html报表,如下所示

 plugin = {
                        "pretty",
                        "json:target/cucumber-report/cucumber.json",
                        "html:target/cucumber-report/cucumber.html"}
 类似资料:
  • 问题内容: 生成成功后,报告将成功生成,但是如果有任何失败的情况导致生成失败,则不会生成报告。 checkBuildResult 已设置为 false pom文件插件 跑步班如下 问题答案: 将以下配置添加到确定的fire插件。失败后,它不会停止执行Maven。然后它将生成报告。 如下面的现有配置所示。

  • 是否可以在测试仍在执行时生成报告。通过潘丁 我的pom.xml是这样的 如果我设置<代码>

  • 我有这个pom.xml文件: 我有一个主要文件: 然后它进行编译,但如果使用运行它,则会出现以下运行时错误: 线程“main”java.lang.NoClassDeffounder中出现异常错误:com/google/gson/gson at suman.app.main(app.java:17)原因:java.lang.ClassNotFoundexception:com.google.gson

  • 问题内容: 在maven中,使用以下语法在pom中设置属性非常容易: 现在,我需要构建一个取决于pom版本的属性。为了创建属性,我想执行以下操作(java伪代码): 它应该是动态的,因为它在我们的存储库中用作标记名,并且必须始终与工件的版本同步。 任何想法如何创建该“动态”属性? 问题答案: Mojo的Build-Helper Maven插件可以在这里为您提供帮助。 有许多目标可用于帮助转换属性。

  • 我试图设置为我的项目的代码覆盖 我的项目基于 下面是我项目的 然后我运行并看到以下内容 然后我运行,我看到 问题 -配置中有什么不正确 -如何生成报告? 谢啦

  • 问题内容: 我有一个多模块Maven项目,其中包含嵌套的其他一些反应堆子模块。结果,我有3个级别的模块层次结构。 过去,我重构了层次结构,将一些嵌套模块从一个移到另一个。我还修改了一些模块的名称。 在Jenkins上,旧模块(现在不存在)在构建报告中显示为“未运行”。当我在本地进行maven安装时,这些模块不会出现在反应堆摘要中。 是否会以某种方式预期这种行为?我的意思是,詹金斯中是否有任何设置可