how to fix the maven surefire plugin error [there was error in the forked process]? how to fix the maven surefire plugin error [there was error in the forked process]? docker docker

how to fix the maven surefire plugin error [there was error in the forked process]?


The above exception log clearly states that it is unable to find the TestRunner class. Make sure your TestRunner class is on the classpath.

I was getting a similar exception due to there were few extra characters added in the Classes section of the TestNG XML file. Its worth checking TestNG XML file is correct and doesn't contain any extra chars than needed structure.


I had a similar issue and after using older version of maven-surefire-plugin solved my issue.

       <plugin>            <artifactId>maven-surefire-plugin</artifactId>            <!-- latest version does not work well with JUnit5 -->            <version>2.19.1</version>            <dependencies>                <dependency>                    <groupId>org.junit.platform</groupId>                    <artifactId>junit-platform-surefire-provider</artifactId>                    <version>1.0.3</version>                </dependency>                <dependency>                    <groupId>org.junit.jupiter</groupId>                    <artifactId>junit-jupiter-engine</artifactId>                    <version>5.0.3</version>                </dependency>            </dependencies>        </plugin>


I faced the same issue but it got resolved with different solution, you can check below problems as well.

Actually i have given the wrong testNG.xml path in POM.XML that's why it was throwing me that error. Please cross verify your testNG.xml path.