serenity-bdd / serenity-cucumber-starter

A skeleton project for Serenity BDD and Cucumber JVM
Apache License 2.0
180 stars 285 forks source link

Unable to run serenity:aggregate when there are multiple failures with 3.4.2 #96

Open atulguru opened 1 year ago

atulguru commented 1 year ago

Recently i upgraded to 3.4.2 and having problems with serenity:aggregate when there are multiple failures in the test run.

When there is only 1 failure it works fine though and serenity report (index.html) get generated.

The jar "org/opentest4j/MultipleFailuresError" is also available in the dependencies.

Error Error Caused by: org.apache.maven.plugin.PluginContainerException: A required class was missing while executing net.serenity-bdd.maven.plugins:serenity-maven-plugin:3.4.2:aggregate: org/opentest4j/MultipleFailuresError

pom <?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">

4.0.0
<groupId>net.serenitybdd.starter</groupId>
<artifactId>cucumber-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Sample Serenity BDD project using Cucumber</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>3.4.2</serenity.version>
    <encoding>UTF-8</encoding>
    <tags></tags>
    <webdriver.base.url></webdriver.base.url>
</properties>
<repositories>
    <repository>
        <id>maven2</id>
        <url>https://repo1.maven.org/maven2</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>maven2</id>
        <url>https://repo1.maven.org/maven2</url>
    </pluginRepository>
</pluginRepositories>
<dependencies>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay-webdriver</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-ensure</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>1.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>5.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.10</version>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.23.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-model</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.opentest4j</groupId>
        <artifactId>opentest4j</artifactId>
        <version>1.2.0</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                    <include>**/*TestSuite.java</include>
                    <include>**/When*.java</include>
                </includes>
                <systemPropertyVariables>
                    <webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
                </systemPropertyVariables>
                <parallel>classes</parallel>
                <parallel>methods</parallel>
                <useUnlimitedThreads>true</useUnlimitedThreads>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.version}</version>
            <configuration>
                <tags>${tags}</tags>
            </configuration>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

baskarcsb commented 1 year ago

this is fixed in 3.4.3 version

atulguru commented 1 year ago

this is fixed in 3.4.3 version

Facing the same error with 3.4.3 version

[ERROR] Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:3.4.3:aggregate (serenity-reports) on project cucumber-starter: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:3.4.3:aggregate failed: A required class was missing while executing net.ser enity-bdd.maven.plugins:serenity-maven-plugin:3.4.3:aggregate: org/opentest4j/MultipleFailuresError

wakaleo commented 1 year ago

OpenTest4j is not directly used by Serenity so it may be a dependency conflict.

atulguru commented 1 year ago

tried running dependency analyzer on the pom file (via plugin maven helper), its not showing any dependency conflicts for OpenTest4j, i am using ver OpenTest4j 1.2.0

atulguru commented 1 year ago

still facing this issue with 3.6.12

Could you advise pls

MarilouK commented 8 months ago

Any news on this?

wakaleo commented 8 months ago

@MarilouK This is a project-specific dependency conflict, not related to Serenity (multiple failures and soft asserts should work fine, even with the opentest dependency). If you need project-specific help, we can do that as part of a commercial support package: https://www.serenity-dojo.com/home1691753380236

atulguru commented 8 months ago

Nope, still awaiting

Recently updated to latest serenity 4.0.21, no luck.

We use soft assertion library a lot in different steps, and do finally do assertAll()

When there are multiple failures, serenity aggregate does not work, i.e index.html does not get created.

Are you also facing this issue? @MarilouK

tburiak commented 7 months ago

@atulguru, I added opentest4j dependency to build script dependencies block and it works for me:

image