mvn serenity:aggregate 运行 0 个测试并且 index.html 有 0 个结果但是 mvn clean verify 工作并得到结果

mvn serenity:aggregate runs 0 tests and index.html has 0 results however mvn clean verify works and gets results

我们将 Serenity Cucumber 与 Maven 集成用于 REST API 自动化项目 运行 Junit。每当尝试执行命令 mvn serenity:aggregate 时,控制台上的结果显示“构建成功”,但加载了 0 个要求,并且 index.html 有 0 个结果并在 target/site/serenity 下生成。而如果 运行命令 mvn clean verify 在同一文件夹下获取结果。

pom.xml插件文件:

        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>2.0.40</version>
            <dependencies>
                <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>serenity-core</artifactId>
                    <version>2.0.40</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>

                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>4.5.0</version>
            <dependencies>
                <dependency>
                    <groupId>com.googlecode.totallylazy</groupId>
                    <artifactId>totallylazy</artifactId>
                    <version>1.20</version>
                    <scope>system</scope>
                    <systemPath>${basedir}/externalMavenLibrary/totallylazy-1.20.jar</systemPath>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>cucumber-jvm-example</projectName>
                        <outputDirectory>${basedir}/target/site/cucumber-pretty</outputDirectory>
                        <jsonFiles>
                            <param>**/*.json</param>
                        </jsonFiles>
                        <classificationFiles>
                            <param>**/*.properties</param>

                        </classificationFiles>
                        <cucumberOutput>${basedir}/target/cucumber.json</cucumberOutput>
                        <enableFlashCharts>true</enableFlashCharts>
                        <checkBuildResult>true</checkBuildResult>
                        <skippedFails>true</skippedFails>

                    </configuration>
                </execution>
            </executions>
        </plugin>

pom.xml 文件中的其他版本:

serenity-cucumber: 1.9.35
serenity-rest-assured: 2.0.45

serenity-core: 2.0.45

serenity-junit: 2.2.1
serenity-maven-plugin: 2.0.40

Serenity.properties 文件:

serenity.project.name=Test
serenity.console.colors=true
serenity.reports.show.step.details=true

由于在 运行ning mvn serenity:aggregate 后无法获得报告,缺少图表和其他不错的功能。 请指导。

能够找出命令不起作用的原因。在 pom.xml 文件中,添加标签后,当 运行 命令通过给出报告输出路径时,我能够按预期获得 Serenity 报告。

更新完成:

serenity.test.root="com.projectname.backend.core"
serenity.reports.show.step.details=true
serenity.outputDirectory = target/site/reports

在pom.xml文件中:添加标签配置,标签在RunnerFile.java

中有值
<plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.maven.version}</version>
            <configuration>
                <tags>${tags}</tags>
            </configuration>

此外,使用了以下依赖版本:

<properties>
<serenity.version>2.2.1</serenity.version>
<serenity.cucumber.version>2.2.0</serenity.cucumber.version>
<serenity.maven.version>2.2.1</serenity.maven.version>
</properties>

使用的命令:

 mvn serenity:aggregate -Dserenity.outputDirectory=C:\Users\projectname\target\site\reports