I need to skip a scenario from running based on a flag which I obtain from the application dynamically in run-time, which tells whether the feature to be tested is enabled. I don't want to throw any exception.
Sample code:
if (JIRA_Integration.equalsIgnoreCase("yes")) {
status = zapi.getTestExecutionStatusInJIRA(scenario.getName());
if(status.equalsIgnoreCase("pass")){
isScenarioAlreadyExecuted = true;
}else {
isScenarioAlreadyExecuted = false;
}
} else {
logger.info("Currently JIRA_Integration is disabled, enable it to update test scenario execution status in JIRA");
}
}
if(isScenarioAlreadyExecuted){
logger.info("Scenario: \"" + scenario.getName() + "\" is already passed in the previous test cycle");
throw new AssumptionViolatedException("Scenario: \"" + scenario.getName() + "\" is already passed in the previous test cycle");
}