junit-team / junit5

āœ… The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Eclipse Public License 2.0
6.44k stars 1.5k forks source link

There was an error in the forked process #1106

Closed lavanyanalabolu closed 7 years ago

lavanyanalabolu commented 7 years ago

Hi,

I have integrated my selenium web framework with the Git hub, which is successfully running on my windows machine, but same thing when iam trying to run on the Jenkins slave machine(linux, ubuntu), getting the following error.

My pom.xml looks like this

<?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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>TestingXperts</groupId>
    <artifactId>com.testautomation</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <main.basedir>${project.basedir}</main.basedir>

    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.3.9</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.13.6</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.1</version>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- Old Extent API<dependency> -->
        <dependency>
            <groupId>com.relevantcodes</groupId>
            <artifactId>extentreports</artifactId>
            <version>2.41.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>1.5.3</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.6</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.39</version>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.8.11.2</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- testlink-java-api -->

        <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xmlrpc-client</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.dropbox.core</groupId>
            <artifactId>dropbox-core-sdk</artifactId>
            <version>2.1.1</version>
        </dependency>

        <!-- Jar files for TestLink -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <!-- ws-commons-util -->
        <dependency>
            <groupId>org.apache.ws.commons.util</groupId>
            <artifactId>ws-commons-util</artifactId>
            <version>1.0.2</version>
        </dependency>
        <!-- xmlrpc-client <dependency> <groupId>org.apache.xmlrpc</groupId> <artifactId>xmlrpc-client</artifactId> 
            <version>3.1.3</version> </dependency> -->
        <!-- xmlrpc-common <dependency> <groupId>org.apache.xmlrpc</groupId> <artifactId>xmlrpc-common</artifactId> 
            <version>3.1.3</version> </dependency> -->

        <!-- Dependencies for JIRA -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.4.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.8</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>20041127.091804</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.3.1</version>
        </dependency>

    <dependency>
    <groupId>com.jayway.restassured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>2.9.0</version>
</dependency>

    </dependencies>

    <build>
        <defaultGoal>test</defaultGoal>
        <sourceDirectory>src/main/java</sourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>

        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.codehaus.sonar-plugins</groupId>
                    <artifactId>sonar-timeline-plugin</artifactId>
                    <version>1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.0</version>
                    <configuration>
                        <verbose>true</verbose>
                        <fork>true</fork>
                        <executable>${JAVA_HOME}/bin/javac</executable>
                        <compilerVersion>1.8</compilerVersion>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

                <!--This plugin is required to run TestNG tests for command line execution -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                    <!--Configuration of TestNG with Maven -->
                    <configuration>
                        <!--Configuration of Parallel Execution -->
                        <!-- <parallel>classes</parallel> <threadCount>3</threadCount> -->
                        <configuration>
                         <printSummary>true</printSummary>
                         </configuration>
                        <properties>
                            <property>
                                <!--Configuration of Verbose of Report or Information -->
                                <name>surefire.testng.verbose</name>
                                <value>2</value>
                            </property>
                        </properties>
                        <suiteXmlFiles>
                            <!--Configuration of xml file that is picked by maven to run TestNG 
                                suite -->
                            <suiteXmlFile>testng.xml.swp</suiteXmlFile>
                        </suiteXmlFiles>
                    </configuration>
                </plugin>
                <!--javadoc -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.10.4</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <name>AutomationFramework</name>

</project>

The error stake looks like below.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.691 s
[INFO] Finished at: 2017-10-12T12:25:18+00:00
[INFO] Final Memory: 15M/237M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project com.testautomation: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Suite file /home/jenkins/workspace/_automation-web-test_master-CKCPK3QTWAJWIZ523MR6MZUPAQLODM3AX23HU3Z7SICQ6ZD3TZKA@2/testng.xml.swp is not a valid file
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:98)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
script returned exit code 1

trying to resolve the issue from 2 days but could not get any working solution. tried adding mvn dependency::tree dint work..

My declarative jenkins file look like below

pipeline {
    agent {
    label 'qa-1'}
    stages {
        stage('Build') {
            agent {
            label 'qa-1'}

        steps {
                sh 'mvn clean'
            }
        }
        stage('Dependencies') {
            agent { 
                label 'qa-1'
            }
           steps {
                sh 'mvn dependency::tree'
            }

        }
        stage('Test on Linux') {
            agent { 
                label 'qa-1'
            }
           steps {
                sh 'mvn test'
            }

        }
    }
}

Thanks in advance.

sormuras commented 7 years ago

Where is the link to JUnit 5?

https://stackoverflow.com might be a better place for this issue.

sbrannen commented 7 years ago

Where is the link to JUnit 5?

There isn't one.

The project in question only uses TestNG as a testing framework, so definitely posted to the wrong repo. šŸ˜œ