getgauge / gauge

Light weight cross-platform test automation
https://gauge.org
Apache License 2.0
2.99k stars 344 forks source link

Jenkins execution of Gauge Specs - Failure #631

Closed natkrish closed 6 years ago

natkrish commented 7 years ago

I have been running gauge specs on Jenkins. But after the upgrade to the latest version which is 0.8.3

Expected behavior

Tests should run successfully without any issues. This started to happen after the upgrade.

Actual behavior

I get the following error

T E S T S

Results :

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

[JENKINS] Recording test results[INFO] [INFO] --- gauge-maven-plugin:1.2.0:execute (default) @ gauge-test ---

specs/dev/devecalgo.spec [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.721 s [INFO] Finished at: 2017-04-19T10:59:02+01:00 [INFO] Final Memory: 27M/336M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.2.0:execute (default) on project gauge-test: Gauge Specs execution failed -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.2.0:execute (default) on project gauge-test: Gauge Specs execution failed at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.maven.Maven3Builder.call(Maven3Builder.java:139) at hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:336) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.maven.plugin.MojoFailureException: Gauge Specs execution failed at com.thoughtworks.gauge.maven.GaugeExecutionMojo.execute(GaugeExecutionMojo.java:108) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 31 more [ERROR] [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/MojoFailureException [JENKINS] Archiving /opt/jenkins2/jobs/test gauge/workspace/pom.xml to com.krish/gauge-test/1.0-SNAPSHOT/gauge-test-1.0-SNAPSHOT.pom channel stopped [htmlpublisher] Archiving HTML reports... [htmlpublisher] Archiving at PROJECT level /opt/jenkins2/jobs/test gauge/workspace/reports/html-report to /opt/jenkins2/jobs/test gauge/htmlreports/HTML_Report Finished: FAILURE

POM file

<?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>com.krish</groupId>
<artifactId>gauge-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

</properties>
<dependencies>

    <!-- https://mvnrepository.com/artifact/com.thoughtworks.gauge/gauge-java -->
    <dependency>
        <groupId>com.thoughtworks.gauge</groupId>
        <artifactId>gauge-java</artifactId>
        <version>0.6.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
        <version>1.5</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>21.0</version>
    </dependency>
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>1.6.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
</dependencies>

<profiles>
    <!--PREPROD_SPECS -->
    <profile>
        <id>PREPROD-SPECS-DOBCHECKBOX</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.thoughtworks.gauge.maven</groupId>
                    <artifactId>gauge-maven-plugin</artifactId>
                    <version>1.2.0</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <configuration>
                                <specsDir>specs/preprod/preprodecalgo.spec</specsDir>
                                <!--<tags>browserBack</tags>-->
                            </configuration>
                            <goals>
                                <goal>execute</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <!--DEV_SPECS -->
    <profile>
        <id>DEV-SPECS</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.thoughtworks.gauge.maven</groupId>
                    <artifactId>gauge-maven-plugin</artifactId>
                    <version>1.2.0</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <configuration>
                                <specsDir>specs/dev/devecalgo.spec</specsDir>
                                <!--<tags>es3</tags>-->
                            </configuration>
                            <goals>
                                <goal>execute</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
<!--ORIGINAL CONFIG FOR GAUGE MAVEN -->
<build>
    <plugins>
        <plugin>
            <groupId>com.thoughtworks.gauge.maven</groupId>
            <artifactId>gauge-maven-plugin</artifactId>
            <version>1.2.0</version>
            <executions>
                <execution>
                    <phase>test</phase>
                    <configuration>
                        <specsDir>specs/ecalgo.spec</specsDir>
                        <!--<tags>dobEntry</tags>-->
                    </configuration>
                    <goals>
                        <goal>execute</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Steps to reproduce

  1. setup and configure jenkins as attached in screenshot
  2. run build now

Gauge version

$ gauge -v Gauge version: 0.8.3

Plugins

csharp (0.10.0) html-report (3.1.0) java (0.6.2) ruby (0.4.0) spectacle (0.1.1) xml-report (0.2.0)

kashishm commented 7 years ago

@natkrish Please re-run using the -X switch to enable full debug logging mvn test -X and share any error messages or stack trace from the console output.

Can you run gauge -v as part of your build to see if gauge command is available to the Jenkins user.

It would be great if you could share logs present in logs directory after the rerun.

natkrish commented 7 years ago

@kashishm Here you go.... Attached

  1. jenkins error stack trace with -X switch
  2. Gauge versions from Jenkins box
  3. Log directory file capture

Jenkins -x switch.txt

logs.zip

kashishm commented 7 years ago

@natkrish Logs also don't have any error messages/stack trace. This usually happens when gauge command is not available to the user or the user doesn't have permission to access $HOME/.gauge/ folder.

natkrish commented 7 years ago

@kashishm when you say 'user' i believe you mean the user as 'jenkins' because when you run it on jenkins - i suppose it will have to be the jenkins user. Is there any troubleshooting that I can do to find out the actual problem itself? I have been really struggling without able to run tests for about a week. Hence asking

natkrish commented 7 years ago

I have also attached the permissions as per from Jenkins in the attached file. Can you please take a look and let me know if anything is missing? gauge permissions.txt

kashishm commented 7 years ago

@natkrish Can you try running gauge specs instead of mvn test in your build. The command will fail because of dependencies not found. But it might give us some info on any permission related issue.

natkrish commented 7 years ago

image

kashishm commented 7 years ago

@natkrish Don't use maven to execute. Just run the following command in Jenkins task instead of maven task

gauge specs/preprod/preprodecalgo.spec
natkrish commented 7 years ago

image

kashishm commented 7 years ago

@natkrish The output has the error message gauge: command not found. Please make sure that the gauge command and the updated $PATH env var is available to the Jenkins user.

natkrish commented 7 years ago

@kashishm I have double triple checked the jenkins box and I can see that it has all the user permission thats required for gauge to run. Is there anything that I can do to resolve this issue? Its been while that I cant run one single test since the upgrade. I am not sure whether other users within the community are having this issue. Can you please investigate?

natkrish commented 7 years ago

This issue is happening even when I run the specs on your site's template projects. gauge --install java_maven_selenium when you run mvn gauge:execute on local - it works fine. however when you run the same on jenkins you get an error.

kashishm commented 7 years ago

@natkrish you can print PATH environment variable in the Jenkins job and see if gauge is available in that.

sriv commented 6 years ago

Closing as stale, feel free to comment if the issue persists.