Discussion:
[Cucumber] [JVM + Jenkins] Rerun failed tests in the same build
Anthony Corsini
2014-06-05 07:37:33 UTC
Permalink
Hi all,


I'm currently running my cucumber tests by invoking gradle script on Jenkins

task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
jvmArgs = ["-Dcucumber.options=" + options]
environment "browser",browser
environment "platform",platform
classpath = configurations.cucumberRuntime +
sourceSets.main.output + sourceSets.test.output
args = ['-f', 'rerun', '-f', 'rerun:target/cucumber-rerun.txt',
'-f', 'json:target/cucumber.json', '--glue', 'com.foo.features.stepDefs',
'src/test/resources']
}
}
}

Everything is fine here but I'd like to rerun my failed tests from the same
build.

I'm not sure this is fully achievable but does anyone already faced the
problem and how did you manage this ?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
aslak hellesoy
2014-06-05 11:30:37 UTC
Permalink
Post by Anthony Corsini
Hi all,
I'm currently running my cucumber tests by invoking gradle script on Jenkins
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
jvmArgs = ["-Dcucumber.options=" + options]
environment "browser",browser
environment "platform",platform
classpath = configurations.cucumberRuntime +
sourceSets.main.output + sourceSets.test.output
args = ['-f', 'rerun', '-f',
'rerun:target/cucumber-rerun.txt', '-f', 'json:target/cucumber.json',
'--glue', 'com.foo.features.stepDefs', 'src/test/resources']
}
}
}
Everything is fine here but I'd like to rerun my failed tests from the
same build.
Let me see if I understand what you mean. After a Cucumber run running all
your scenarios you want to immediately (and automatically) kick off a new
run - this time running only the ones that failed in the previous run?

What do you hope to achieve with this?

Aslak
Post by Anthony Corsini
I'm not sure this is fully achievable but does anyone already faced the
problem and how did you manage this ?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Anthony Corsini
2014-06-05 14:48:03 UTC
Permalink
Post by aslak hellesoy
Post by Anthony Corsini
Hi all,
I'm currently running my cucumber tests by invoking gradle script on Jenkins
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
jvmArgs = ["-Dcucumber.options=" + options]
environment "browser",browser
environment "platform",platform
classpath = configurations.cucumberRuntime +
sourceSets.main.output + sourceSets.test.output
args = ['-f', 'rerun', '-f',
'rerun:target/cucumber-rerun.txt', '-f', 'json:target/cucumber.json',
'--glue', 'com.foo.features.stepDefs', 'src/test/resources']
}
}
}
Everything is fine here but I'd like to rerun my failed tests from the
same build.
Let me see if I understand what you mean. After a Cucumber run running all
your scenarios you want to immediately (and automatically) kick off a new
run - this time running only the ones that failed in the previous run?
What do you hope to achieve with this?
Aslak
You understood well.
Purpose is to run again the tests which fails for some unknown reasons.
My test base is really stable using firefox but not with phantom and I
would appreciate to rerun them easily.

As we exit process with 'non-zero exit value 1' when a test is failed, the
build is automatically failed as consequence we cannot rerun tests

At the moment I have a specific build to rerun test one by one
task cucumberRerun() {
dependsOn assemble, compileTestJava
doLast {
def file = new File('target/cucumber-rerun.txt')
for (int i = 0; i < file.getText().split(" ").length; i++) {
split = file.getText().split(" ")[i]
feature = 'src/test/resources/' + split
try {
javaexec {
main = "cucumber.api.cli.Main"
environment "browser",browser
environment "platform",platform
classpath = configurations.cucumberRuntime +
sourceSets.main.output + sourceSets.test.output
args = ['--glue', 'com.foo.features.stepDefs', feature]
}
} catch (Exception e) {
println e
}
}
}
}


It would be great if it was possible, perhaps it is but I don't know how to.

Anthony
Post by aslak hellesoy
I'm not sure this is fully achievable but does anyone already faced the
Post by Anthony Corsini
problem and how did you manage this ?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...