Discussion:
[Cucumber] How can I change the scenario result in the @After hook
Add Reply
n***@anakatech.com
2018-10-01 13:55:40 UTC
Reply
Permalink
Hello,

I want somehow to mark the failing tests because of known issues into the
test report.
I was thinking about something like the following into the @After hook but
I don't know how can I override the current scenario's Result:

@After
public void afterScenario(Scenario scenario) {
if (scenario.isFailed() && scenario.getSourceTagNames().contains(
"someJiraIssueNumber") {

// change result here
scenario.add(new Result("knownIssue", null, null));

}

}



Regards,

Nayden
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Kessler
2018-10-07 14:42:39 UTC
Reply
Permalink
Post by n***@anakatech.com
Hello,
I want somehow to mark the failing tests because of known issues into the
test report.
If you know that the test will encounter a known issue, then why run the
test in the first place?
Post by n***@anakatech.com
@After
public void afterScenario(Scenario scenario) {
if (scenario.isFailed() && scenario.getSourceTagNames().contains(
"someJiraIssueNumber") {
Instead of changing a test result based on its tags just use those tags to
exclude the test from being run.
Post by n***@anakatech.com
// change result here
scenario.add(new Result("knownIssue", null, null));
}
}
Regards,
Nayden
Eric
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...