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

Serenity bdd生成运行时报告

卫烨烁
2023-03-14

是否可以在测试仍在执行时生成报告。通过潘丁

我的pom.xml是这样的

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


    <modelVersion>4.0.0</modelVersion>


    <groupId>com.insurance.abc</groupId>
    <artifactId>insurance</artifactId>
    <version>1.0-SNAPSHOT</version>



    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>



    <dependencies>

        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-jbehave</artifactId>
            <version>1.13.0</version>
        </dependency>

        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>1.1.37-rc.6</version>
        </dependency>

    </dependencies>



    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9.1</version>
                <!--<executions>
                    <execution>
                        <id>add-integration-test-source-as-test-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/it/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>-->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                   </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>1.1.37-rc.6</version>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-core</artifactId>
                        <version>1.1.37-rc.6</version>
                    </dependency>
                </dependencies>
                 <executions>
                    <execution>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

如果我设置<代码>

共有1个答案

卞轶
2023-03-14

您看到的行为原因相当简单:随着测试的运行,Jbehave将目标/jbehave/中每个测试的结果保存为storyclass.htmlstoryclass.stats。当报告生成运行时,它会使用这些文件在目标/jbehave/报告下生成报告。通过在运行测试之前尝试生成报告,您将生成没有输入的报告。

关于如何达到你想要的结果,我觉得Jbehave并没有提供任何官方途径。

我不建议这样做,但是如果我必须这样做,我会首先尝试添加一个@Afterstories步骤,该步骤运行报告生成,以便在每次故事完成时更新报告。问题是,即使它有效,每次发生这种情况,整个报告都会重新生成,随着测试套件中的每个故事运行,它会变得越来越慢,所以如果你有一个大的套件,你最终会增加一点执行时间。然后,您可以更进一步,让您的步骤执行一些自定义的轻量级报告生成,为您提供一个附加的临时状态报告,而不是重新创建报告,该报告可以由Jwell后执行生成的完整报告替换。

 类似资料:
  • 请找到我的pom.xml 4.0.0 @runwith(cucumber.class)@cucumberoptions(features={“c:\users\rishabh patel\eclipse-workspace\cucumberreports\feature”},glue={“stepdefinition”},plugin={“pretty”,“json:target/cucumber

  • 当类与 TestNG 并行运行时,我们不会获得范围报告,但 TestNG 报告会更新。请找到我正在使用的示例代码和版本。如果我们只运行一个类(TestClass1.java),则将生成范围报告。 硒版本3.4.0 范围报告版本:3.0.6 扩展报告库.java 测试类1.java TestClass2.java testng.xml

  • 这与我自己的Runner和Filter类以及注释一起,意味着我可以在一个单独的类中运行一个单独的测试,如下所示: 这在Jenkins中也是非常好的,我也能够并行运行测试。我遇到的问题是,每个类的报告在每个方法运行后都会被覆盖。 例如,上面的命令将生成一个文件test-classwithtests.xml,其中包含关于TestMethod的结果和输出的信息。但是,如果我跑

  • 0信息如果它以ok结尾就可以工作1详细cli['C:\程序文件\nodejs\node.exe',1详细cli'C:\users\bhargavii nadendla\appdata\roaming\npm\node_module\npm\bin\npm-cli.js',1详细cli'run',1详细cli'build']2使用npm@6.0.1 3使用node@v8.11.2 4详细run-sc

  • What the world really needs is more love and less paperwork. — Pearl Bailey 大型的基础设施架构往往是真正的第一受害者。如果你正管理着许多机器, 那么使用 Puppet 的报告设施,可以为你提供一些关于正在发生什么的有价值的信息。 操作步骤 要启用报告,只要将如下的行加入客户端的 puppet.conf 文件: report

  • 我从Sonar GitHub repo中的“java gradle simple”示例开始: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/java/gradle/java-gradle-simple 我已经将jacoco插件添加到我的构建中。gradle文件在一个空文件中查看单元测试覆盖率