Serenity report isn't generating in Cucumber project

163 Views Asked by At

I am learning Cucumber. I wanted to create a Serenity report for my Cucumber project. I included all the dependency and plugin. Test runs OK, but no report is generated. I also included serenity.properties file in 'src/test/resources' folder.

When I run the file from command using mvn clean verify, the full test run as it is supposed to, and a site/serenity folder is added under target folder, but nothing is there.

My pom.xml file:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>11.0.19</java.version>
    <junit.version>4.13.2</junit.version>
    <cucumber.version>7.14.0</cucumber.version>
    <maven.compiler.version>3.11.0</maven.compiler.version>
    <maven.surefire.version>3.2.2</maven.surefire.version>
</properties>

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

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

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

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

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

    <!--https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>5.5.3</version>
    </dependency>

    <!--
    https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.15.0</version>
    </dependency>

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

    <dependency>
        <groupId>tech.grasshopper</groupId>
        <artifactId>extentreports-cucumber7-adapter</artifactId>
        <version>1.14.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.2.5</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.2.5</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.8.0</version>
        <scope>test</scope>
    </dependency>

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

    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-core -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>4.0.28</version>
    </dependency>

    <!--
    https://mvnrepository.com/artifact/net.serenity-bdd/serenity-cucumber -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>4.0.28</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-junit -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>4.0.28</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-ensure -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-ensure</artifactId>
        <version>4.0.28</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.version}</version>
                <configuration>
                    <includes>
                        <!-- <include>**/testRunner01.java</include>-->
                        <include>**/SerenityTestRunner.java</include>
                    </includes>
                    <parallel>methods</parallel>
                    <threadCount>4</threadCount>
                    <useUnlimitedThreads>false</useUnlimitedThreads>
                </configuration>
            </plugin>
            
            
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>4.0.28</version>
                <dependencies>
                    <dependency>
                        <groupId>net.serenity-bdd</groupId>
                        <artifactId>serenity-single-page-report</artifactId>
                        <version>4.0.28</version>
                    </dependency>
                </dependencies>
                <configuration>
                    
                    <reports>single-page-html</reports>
                </configuration>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </pluginManagement>
</build>

My test runner file:

package testRunner;

import org.junit.runner.RunWith;

import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        features = {"src/test/resources/features/HomePage.feature"},
        glue = {"parallel"},
        plugin = "pretty"
        )
public class SerenityTestRunner {

}
0

There are 0 best solutions below