How to re-run failed test cases using mvn gauge:execute

703 views
Skip to first unread message

Sreejith Edayillam

unread,
Apr 3, 2017, 8:52:46 AM4/3/17
to getgauge
Hi,

I setup a maven gauge project and running it from Jenkins.

Just curious to know whether i can re-run the failed test cases using mvn gauge:execute. I saw gauge --failed but not sure how to use the same command with mvn gauge:execute.

Any help on this is really appreciated.

Thank You,
Sreejith.


Srikanth V

unread,
Apr 3, 2017, 11:51:38 AM4/3/17
to getgauge
Hi,

You can use the -DFlags option to pass additional flags to gauge via maven. Ref here: https://docs.getgauge.io/configuration.html#all-additional-properties

Specifically, in your case you can do mvn gauge:execute -DFlags="--failed".

HTH
Srikanth

Sreejith Edayillam

unread,
Apr 3, 2017, 11:33:24 PM4/3/17
to getgauge
Thank You Sriknath.
Message has been deleted

Rafees Rahim

unread,
Jul 5, 2017, 4:59:57 AM7/5/17
to getgauge
I am also facing the same issue. Can you please tell us where we have to give mvn gauge:execute -DFlags="--failed" in our eclipse and also in our jenkins job.

Srikanth V

unread,
Jul 5, 2017, 9:19:31 PM7/5/17
to getgauge
Hi,

On every gauge run, if there are failures they are recorded in a file : <ProjectRoot>/.gauge/failures.json. The "--failed" flag would look at your project directory and see if there is a .gauge/failures.json, and use it to rerun failed tests.

So typically you woudl use the "--failed" flag after a run with failed test. So the workflow would be something like this:

mkdir sample
cd sample
gauge --init java
# add your specs and implementations
gauge specs
# some failures!
gauge --failed specs
# rerun the failed tests


You can map this to your eclipse/jenkins setup. However, running --failed in a CI environment can be a sign of flaky test(s). So please consider that, and do not ignore the hint!

hope this helps
Srikanth
Reply all
Reply to author
Forward
0 new messages