如何在JAVA中跳过运行时使用Cucumber-JVM的场景

时间:2018-01-30 14:17:42

标签: java selenium cucumber-jvm cucumber-java

我需要根据我在运行时动态从应用程序获取的标志跳过运行方案,该标志告知是否启用了要测试的功能。我不想抛出任何异常。

示例代码:

            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");
        }

0 个答案:

没有答案