Re-run failed tests for maven project

354 views
Skip to first unread message

Osanda Deshan Nimalarathna

unread,
Oct 30, 2020, 10:08:56 AM10/30/20
to getgauge
Hi All,

I am using gauge with maven. To run the specifications I am using below command.
mvn test-compile gauge:execute -DspecsDir="specs"

I need to re-run the failed tests in that project. I have tried below commands, but there are not working.
mvn test-compile gauge:execute -DspecsDir="specs" --failed

What should be the correct command to run failed tests in a maven project? Also I would like to know after we rerun the tests, will it modify the earlier execution report? or will it create a new execution report for the re-run tests?

Appreciate your help on this.

Zabil C M

unread,
Oct 30, 2020, 10:18:34 AM10/30/20
to getg...@googlegroups.com
Hey Osanda,

As you are using maven all flags must be passed as maven parameters. So you need to modify the command to

mvn test-compile gauge:execute -DspecsDir="specs" -Dflags="--failed"

You can find more information about this at https://github.com/getgauge-contrib/gauge-maven-plugin#executing-specs

The report will show the status of the re-run failed tests and mark others as skipped.
--
You received this message because you are subscribed to the Google Groups "getgauge" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getgauge+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/getgauge/aa5317fd-2a54-4b38-9340-6538f0c34b18n%40googlegroups.com.

Osanda Deshan Nimalarathna

unread,
Oct 30, 2020, 10:30:41 AM10/30/20
to getgauge
Hi Zabil,

When I tried it, it failed and this is the -X log

mvn test-compile gauge:execute -DspecsDir="specs" -Dflags="--failed" -X

[DEBUG] [gauge] Executing => [gauge, run, --failed, --dir=C:\Users\onimalarat\IdeaProjects\Web-Cross-Browser-Automation-Demo, C:\Users\onimalarat\IdeaProjects\Web-
Cross-Browser-Automation-Demo\specs]
Invalid Command. Usage: gauge run --failed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.555 s
[INFO] Finished at: 2020-10-30T19:57:52+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.3.0:execute (default-cli) on project web-cross-browser-automation-demo: Gauge Spec
s execution failed -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.3.0:execute (default-cli) on proje
ct web-cross-browser-automation-demo: Gauge Specs execution failed
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    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.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Gauge Specs execution failed
    at com.thoughtworks.gauge.maven.GaugeExecutionMojo.execute (GaugeExecutionMojo.java:105)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    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.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

C:\Users\onimalarat\IdeaProjects\Web-Cross-Browser-Automation-Demo>


Zabil C M

unread,
Oct 30, 2020, 10:33:32 AM10/30/20
to getg...@googlegroups.com
My bad it should be 

mvn gauge:execute -Dflags="--failed"

Without adding -DspecsDir="specs" 

Osanda Deshan Nimalarathna

unread,
Oct 30, 2020, 10:59:34 AM10/30/20
to getgauge
Hi Zabil,

It still failing. Please find the terminal output here.

C:\Users\onimalarat\IdeaProjects\Web-Cross-Browser-Automation-Demo>mvn gauge:execute -Dflags="--failed"
[INFO] Scanning for projects...
[INFO]
[INFO] ----< com.maxsoft.webautomation:web-cross-browser-automation-demo >-----
[INFO] Building web-cross-browser-automation-demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- gauge-maven-plugin:1.3.0:execute (default-cli) @ web-cross-browser-automation-demo ---
[WARNING] [gauge] Property 'specsDir' not set. Using default value => 'specs'
Invalid Command. Usage: gauge run --failed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.885 s
[INFO] Finished at: 2020-10-30T20:26:12+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.3.0:execute (default-cli) on project web-cross-browser-automation-demo: Gauge Spec
s execution failed -> [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:

C:\Users\onimalarat\IdeaProjects\Web-Cross-Browser-Automation-Demo>

I am using this configuration in pom.xml

<build>
    <plugins>
        <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>
        <plugin>
            <groupId>com.thoughtworks.gauge.maven</groupId>
            <artifactId>gauge-maven-plugin</artifactId>
            <version>1.3.0</version>
            <executions>
                <execution>
                    <phase>test</phase>
                    <configuration>
                        <specsDir>specs</specsDir>
                    </configuration>
                    <goals>
                        <goal>execute</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Gauge version

Gauge version: 1.0.8
Commit Hash: 28617ea

Plugins
-------
flash (0.0.2)
html-report (4.0.10)
java (0.7.4)
js (2.3.10)
json-report (0.3.3)
reportportal (1.4.0)
screenshot (0.0.1)
spectacle (0.1.4)
xml-report (0.2.3)

Zabil C M

unread,
Oct 30, 2020, 11:14:21 AM10/30/20
to getg...@googlegroups.com
This might be something to do with the old versions of gauge and the gauge maven plugin

This works as documented on the sample java_maven project. With gauge version 1.1.4 this works locally. You can try initialising this project and changing you pom.xml accordingly.

$ gauge init java_maven
$ mvn test
$ mvn test -Dflags="--failed" -q
No failed tests found.

Osanda Deshan Nimalarathna

unread,
Oct 30, 2020, 12:22:36 PM10/30/20
to getgauge
It worked.

Thanks a lot Zabil

Reply all
Reply to author
Forward
0 new messages