Deena P
Deena P

Reputation: 105

how to force a cucumber scenario to pass?

I have my framework integrated with JIRA, wheneven I execute scripts, it will check with JIRA for the testcase status, then will it run. If it's already passed, right now I am handling it with

throw new SkipException("\"Scenario: \\\"\" + scenario.getName() + \"\\\" is already passed in the previous test cycle\"");

But this fails the scenario in reports.

Instead I want to show this scenario as PASS in the report. Any solution?

Upvotes: 0

Views: 2020

Answers (2)

M.P. Korstanje
M.P. Korstanje

Reputation: 12059

Cucumber JVM currently only recognizes org.junit.internal.AssumptionViolatedException and org.junit.AssumptionViolatedException as skip exceptions. These can be thrown through Junit Assume.

I assume you're using TestNG to throw the SkipException. This exception is not supported. You'll have to create a PR to get it supported.

Upvotes: 1

Tomas Panik
Tomas Panik

Reputation: 4619

For this purpose there is built-in support for skipping scenario

just return skipped string from your step.

As result it will be in special "Skipped" state which should be marked as OK in most of the reporting frameworks (usually gray color).

Upvotes: 0

Related Questions