Search code examples
rest-assuredserenity-bddcucumber-serenity

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


We have Serenity Cucumber integrated with Maven for REST API automation project running with Junit. Whenever trying to execute the command mvn serenity:aggregate results on console shows "Build success' but with 0 requirements loaded and index.html has 0 results and generated under target/site/serenity. Whereas if run with the command mvn clean verify getting results under the same folder.

pom.xml file of plugin:

        <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>

Other versions in the pom.xml file:

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 file:

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

Since unable to get report after running mvn serenity:aggregate, missing graphs and other nice features. Please guide.


Solution

  • Able to figure out the reason why the command was not working. in pom.xml file, after adding tags and while running the command by giving the report output path, I am able to get the Serenity reports as expected.

    updates done:

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

    in pom.xml file: added tags configuration, and the tag has value in 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>
    

    Also, below dependency versions used:

    <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>
    

    Command used:

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