Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serenity 4.0.1 : There was an error in the forked process TestEngine with ID 'junit-platform-suite' failed to discover tests #3370

Open
NandhakumarSubbaiah opened this issue Jan 9, 2024 · 1 comment
Labels

Comments

@NandhakumarSubbaiah
Copy link

Hi All,
When I tried to migrate serenity 3.x.x to 4.x.x with reference to https://serenity-bdd.github.io/docs/tutorials/migrating_to_serenity_4 , I am getting "There was an error in the forked process TestEngine with ID 'junit-platform-suite' failed to discover tests" error.

below is the pom.xml I have updated.


4.0.0

<groupId>com.transunion.qecop</groupId>
<artifactId>test</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<name>Automation Feature Files</name>
<parent>
    <groupId>com.transunion.qecop</groupId>
    <artifactId>graphene-parent</artifactId>
    <version>2.0</version>
</parent>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    
    <serenity.version>4.0.1</serenity.version>
    <junit-vintage-engine.version>5.10.0</junit-vintage-engine.version>
    <!-- <junit-platform-suite.version>1.9.3</junit-platform-suite.version>-->
    <junit-platform-suite.version>1.10.0</junit-platform-suite.version>
    <cucumber-junit-platform-engine.version>7.2.3</cucumber-junit-platform-engine.version>
    <encoding>UTF-8</encoding>
    <tags></tags>
    <parallel>1</parallel> <!--Parallel thread count-->
    <parallel.type>methods</parallel.type> <!--Comment this line in case of single Thread. ie. Parallel = 1-->
    <webdriver.base.url></webdriver.base.url>
    <cucumber.filter.tags></cucumber.filter.tags>
</properties>

<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>${junit-platform-suite.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit-platform-engine</artifactId>
        <version>${cucumber-junit-platform-engine.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-suite</artifactId>
        <version>${junit-platform-suite.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit-vintage-engine.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>${junit-vintage-engine.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.10</version>
    </dependency>
   
    <dependency>
        <groupId>com.epam.reportportal</groupId>
        <artifactId>agent-java-cucumber6</artifactId>
        <version>5.1.2</version>
    </dependency>
    <dependency>
        <groupId>com.transunion.qecop.automation</groupId>
        <artifactId>tu-graphene-base</artifactId>
        <version>2.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.12.4</version>
    </dependency>

</dependencies>
<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.1.2</version>
            <configuration>
                <!--                    <debugForkedProcess>true</debugForkedProcess>-->
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
                <fast>true</fast>
            </configuration>
            <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>Framework Setup</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <classpathScope>test</classpathScope>
                        <mainClass>com.transunion.qecop.test.BeforeRun</mainClass>
                        <systemProperties>
                            <systemProperty>
                                <key>ReportportalFilePath</key>
                                <value>${project.basedir}\\src\\test\\resources\\reportportal.properties</value>
                            </systemProperty>
                            <systemProperty>
                                <key>cfgFile</key>
                                <value>${project.basedir}\\src\\test\\resources\\cfgFile.json</value>
                            </systemProperty>
                            <systemProperty>
                                <key>capsFile</key>
                                <value>${project.basedir}\\src\\test\\resources\\capsFile.json</value>
                            </systemProperty>
                            <systemProperty>
                                <key>FileDownloadPath</key>
                                <value>${project.basedir}\\src\\test\\resources\\downloads\\</value>
                            </systemProperty>
                            <systemProperty>
                                <key>ScreenshotPath</key>
                                <value>${project.basedir}\\src\test\\resources\\screenshots\\</value>
                            </systemProperty>
                            <systemProperty>
                                <key>TestDataPath</key>
                                <value>${project.basedir}\\src\\test\\resources\\testdata\\</value>
                            </systemProperty>
                            <systemProperty>
                                <key>DriverPath</key>
                                <value>${project.basedir}\\src\\test\\resources\\drivers\\</value>
                            </systemProperty>
                        </systemProperties>
                    </configuration>
                </execution>
                <execution>
                    <id>Framework Teardown</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <classpathScope>test</classpathScope>
                        <mainClass>com.transunion.qecop.test.AfterRun</mainClass>
                        <systemProperties>
                            <systemProperty>
                                <key>ReportportalFilePath</key>
                                <value>${project.basedir}\\src\\test\\resources\\reportportal.properties</value>
                            </systemProperty>
                        </systemProperties>
                    </configuration>
                </execution>
                
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.1.2</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                    <include>**/*TestSuite.java</include>
                    <include>**/When*.java</include>
                    <!--                        <include>**/test/*Test.java</include>-->

                </includes>
                <systemPropertyVariables>
                    <!--<webdriver.base.url>${webdriver.base.url}</webdriver.base.url>-->
                    <webdriver.driver>provided</webdriver.driver>
                    <webdriver.provided.type>mydriver</webdriver.provided.type>
                    <webdriver.provided.mydriver>com.transunion.qecop.automationframework.GetDriver</webdriver.provided.mydriver>
                    <serenity.driver.capabilities>provided</serenity.driver.capabilities>
                    <cfgFile>${project.basedir}\\src\\test\\resources\\cfgFile.json</cfgFile>
                    <capsFile>${project.basedir}\\src\\test\\resources\\capsFile.json</capsFile>
                    <FileDownloadPath>${project.basedir}\\src\\test\\resources\\downloads\\</FileDownloadPath>
                    <ScreenshotPath>${project.basedir}\\src\test\\resources\\screenshots\\</ScreenshotPath>
                    <TestDataPath>${project.basedir}\\src\\test\\resources\\testdata\\</TestDataPath>
                    <SystemFilePath>${project.basedir}\src\test\resources\testdata\</SystemFilePath>
                    <DriverPath>${project.basedir}\\src\\test\\resources\\drivers\\</DriverPath>
                    <ReportportalFilePath>${project.basedir}\\src\\test\\resources\\reportportal.properties</ReportportalFilePath>
                    <!--This browser setting will override your Capability Json file settings-->
                    <type></type>
                    <environment></environment>
                </systemPropertyVariables>
                <!--                    <parallel>${parallel.type}</parallel>-->
                <parallel>${parallel.type}</parallel>
                <!--                    <parallel>methods</parallel>-->
                <threadCount>${parallel}</threadCount>
                <useUnlimitedThreads>true</useUnlimitedThreads>
                <perCoreThreadCount>true</perCoreThreadCount>
                <forkCount>${parallel}</forkCount>
            </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>
                <reports>single-page-html</reports>
            </configuration>
            <!-- <dependencies>
                 <dependency>
                     <groupId>net.serenity-bdd</groupId>
                     <artifactId>serenity-core</artifactId>
                     <version>${serenity.version}</version>
                 </dependency>-->
            <!--<dependency>
                <groupId>net.serenity-bdd</groupId>
                <artifactId>serenity-single-page-report</artifactId>
                <version>${serenity.version}</version>
            </dependency>
        </dependencies>-->
            <!-- <configuration>

<!– ${cucumber.filter.tags}–>
single-page-html
-->


serenity-reports
post-integration-test

aggregate







Project structure :
test
--java
--com.transunion.qecop
--bizcomp
--stepdefinitions
--steplibrary
--steps
--utilities
--runner
--CucumberTestSuite
--resources
--features

Runner Files

package com.transunion.qecop.runner;

import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;

@suite
@IncludeEngines("cucumber")
//@SelectClasspathResource("com.transunion.qecop.runner")
@SelectClasspathResource("/features/UI")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "io.cucumber.core.plugin.SerenityReporterParallel,pretty,timeline:build/test-results/timeline")

public class CucumberTestSuite {
}

@wakaleo
Copy link
Member

wakaleo commented Jan 9, 2024

This ("There was an error in the forked process TestEngine with ID 'junit-platform-suite' failed to discover tests" error.") is a classic JUnit 5 library compatibility issue. Unfortunately quite tricky to resolve, but it's essentially a dependency conflict. Make sure all the JUnit libraries have the correct versions (and use Serenity 4.0.31).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants