0

I'm new to automation and don't understand why my build shows failure in the console window when I execute testng.xml via pom.xml although tests execute fine.

Copying my pom.xml and error which might be helpful. If there is something needed, please let me know. Your help would be highly appreciated.

POM.xml is as below:

<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>com.bookbaby.tests</groupId>
    <artifactId>CucumberTestNGMaven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.4.0</version>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>1.2.5</version>
        </dependency>


        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>3.7.0</version>
        </dependency>

        <!-- <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.2.3</version>
        </dependency> -->
        <!-- <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency> -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
        <!-- This plugin is used to run java main class file -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <compilerVersion>1.8</compilerVersion>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <!-- This plugin is used to run java main class file -->
            <!-- <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>

                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>com.bookbaby.executor.RunSuite</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin> -->

    <!-- To run testNg.xml we need below plugin -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20</version>
        <!-- <inherited>true</inherited> -->
        <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>testngSingle.xml</suiteXmlFile>
                </suiteXmlFiles>
                    <skipTests>false</skipTests>
                <properties>
                    <property>
                        <name>suitethreadpoolsize</name>
                        <value>3</value>
                    </property>
                </properties>
                <testFailureIgnore>false</testFailureIgnore>
          </configuration>

          </plugin>
        </plugins>
    </build>
</project>

Error is below

[INFO] Scanning for projects... [INFO]
    [INFO]------------------------------------------------------------------------ [INFO]
Building CucumberTestNGMaven 1.0-SNAPSHOT [INFO]
------------------------------------------------------------------------ [INFO]  [INFO] --- maven-resources-plugin:2.6:resources
(default-resources) @ CucumberTestNGMaven --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @
CucumberTestNGMaven --- [INFO] Changes detected - recompiling the
module! [INFO] Compiling 41 source files to
C:\Users\Refaque\workspace\CucumberTestNGMavenParallelRunTestng\target\classes
[INFO]  [INFO] --- maven-resources-plugin:2.6:testResources
(default-testResources) @ CucumberTestNGMaven --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile
(default-testCompile) @ CucumberTestNGMaven --- [INFO] Nothing to
compile - all classes are up to date [INFO]  [INFO] ---
maven-surefire-plugin:2.20:test (default-test) @ CucumberTestNGMaven
--- [INFO]  [INFO] ------------------------------------------------------- [INFO]  T E S T S [INFO] -------------------------------------------------------
[INFO] Running TestSuite doing set up in RunCukesByFeatureForFirefox
Jul 24, 2017 4:13:08 PM org.openqa.selenium.remote.ProtocolHandshake
createSession INFO: Detected dialect: OSS RemoteWebDriver: firefox on
ANY (2f84874a-05a3-48ae-8884-5ca277ff7f54) Hooks Executing
RemoteWebDriver: firefox on ANY (2f84874a-05a3-48ae-8884-5ca277ff7f54)
EXECUTING SCENARIO >>>Successfull login functionality Searching
element By.xpath: //a[@class='wisepop-close'] for presence, will wait
by 30 seconds Searching element By.xpath: //*[@id='login-link']/span
for presence, will wait by 30 seconds Searching element
By.cssSelector:
input[id="ctl00_ctl00_cphContent_cphContent_txtUserName"] for
> presence, will wait by 30 seconds Searching element By.cssSelector:
> input[id="ctl00_ctl00_cphContent_cphContent_txtPassword"] for
> presence, will wait by 30 seconds Searching element By.id:
> ctl00_ctl00_cphContent_cphContent_btnLogin for presence, will wait by
> 30 seconds Searching element By.xpath:
> //*[@id='header-menu']/div[2]/a/img for presence, will wait by 30
> seconds
> 
> 1 Scenarios ([32m1 passed[0m) 8 Steps ([32m8 passed[0m) 0m19.141s
> 
> executing after suite [INFO] Tests run: 1, Failures: 0, Errors: 0,
> Skipped: 0, Time elapsed: 56.446 s - in TestSuite [INFO]  [INFO]
> Results: [INFO]  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped:
> 0 [INFO]  [INFO]
> ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
> ------------------------------------------------------------------------ [INFO] Total time: 01:00 min [INFO] Finished at:
> 2017-07-24T16:13:51+01:00 [INFO] Final Memory: 22M/315M [INFO]
> ------------------------------------------------------------------------ [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-surefire-plugin:2.20:test
> (default-test) on project CucumberTestNGMaven: There are test
> failures. [ERROR]  [ERROR] Please refer to
> C:\Users\Refaque\workspace\CucumberTestNGMavenParallelRunTestng\target\surefire-reports
> for the individual test results. [ERROR] Please refer to dump files
> (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and
> [date]-jvmRun[N].dumpstream. [ERROR] Error occurred in starting fork,
> check output in log [ERROR]
> org.apache.maven.surefire.booter.SurefireBooterForkException: Error
> occurred in starting fork, check output in log [ERROR] at
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:634)
> [ERROR] at
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
> [ERROR] at
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:279)
> [ERROR] at
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:243)
> [ERROR] at
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1077)
> [ERROR] at
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:907)
> [ERROR] at
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:785)
> [ERROR] at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> [ERROR] at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
> [ERROR] at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> [ERROR] at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> [ERROR] at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> [ERROR] at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> [ERROR] at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> [ERROR] at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> [ERROR] at
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) [ERROR]
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> [ERROR] at
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) [ERROR]
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) [ERROR] at
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) [ERROR] at
> org.apache.maven.cli.MavenCli.main(MavenCli.java:199) [ERROR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [ERROR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [ERROR] at java.lang.reflect.Method.invoke(Method.java:498) [ERROR] at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> [ERROR] at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> [ERROR] at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> [ERROR] at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> [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/MojoExecutionException`
Sanchit
  • 315
  • 2
  • 20
Ref
  • 27
  • 1
  • 8
  • Formated XML. When you mis format it, it do not display because browsers try to interpret it as HTML – litelite Jul 24 '17 at 20:17
  • did you try to add as stated in https://stackoverflow.com/questions/9320620/junit-maven-error-occured-in-starting-fork-check-output-in-log? What is the goal of your suitethreadpoolsize? Did you try to comment it out? I mean the full properties definition – yohann.martineau Jul 24 '17 at 20:28
  • @yohann.martineau 2 - Commented out full properties definition and added but still no luck. – Ref Jul 24 '17 at 23:17
  • Did You try to comment out everything also and let testngSingle.xml run in parell by http://testng.org/doc/documentation-main.html#parallel-tests ? – jadupl Jul 25 '17 at 09:42
  • I did try just running testngSingle.xml as TestNGSuite and runs fine. it only gives issues when I run with maven and fails the build. – Ref Jul 25 '17 at 13:02
  • I myself got it working by adding never although yohann.martineau 21 suggested me with "once" which didnt work but "never" worked for me. Thanks everyone. – Ref Jul 25 '17 at 18:28
  • @Ref - You might want to post that as an answer to your question and accept it as well. That way the question would get closed. – Krishnan Mahadevan Jul 26 '17 at 05:41

1 Answers1

0

I myself got it working by adding never although yohann.martineau 21 suggested me with "once" which didnt work but "never" worked for me. Thanks everyone.

Ref
  • 27
  • 1
  • 8