private void runScenario( ExecutionToken executionToken, HandlerManager handlerManager, ScenarioToken scenario, boolean skip) throws Exception { executionListenerSupport.notifyScenarioStarted(executionToken, scenario); log.info(String.format("Processing scenario: %s", scenario.getName())); // reset the ChorusContext for the scenario ChorusContext.destroy(); handlerManager.setCurrentScenario(scenario); List<Object> handlerInstances = handlerManager.getOrCreateHandlersForScenario(); handlerManager.processStartOfScope(Scope.SCENARIO, handlerInstances); createTimeoutTasks( Thread .currentThread()); // will interrupt or eventually kill thread / interpreter if blocked log.debug("Running scenario steps for Scenario " + scenario); StepInvokerProvider p = getStepInvokers(handlerInstances); stepProcessor.runSteps(executionToken, p, scenario.getSteps(), skip); stopTimeoutTasks(); // the special start or end scenarios don't count in the execution stats if (!scenario.isStartOrEndScenario()) { updateExecutionStats(executionToken, scenario); } handlerManager.processEndOfScope(Scope.SCENARIO, handlerInstances); executionListenerSupport.notifyScenarioCompleted(executionToken, scenario); }
private void runScenarios( ExecutionToken executionToken, FeatureToken feature, List<ScenarioToken> scenarios, HandlerManager handlerManager) throws Exception { log.debug("Now running scenarios " + scenarios + " for feature " + feature); for (Iterator<ScenarioToken> iterator = scenarios.iterator(); iterator.hasNext(); ) { ScenarioToken scenario = iterator.next(); // if the feature start scenario exists and failed we skip all but feature end scenario boolean skip = !scenario.isFeatureStartScenario() && !scenario.isFeatureEndScenario() && feature.isFeatureStartScenarioFailed(); if (skip) { log.warn( "Skipping scenario " + scenario + " since " + KeyWord.FEATURE_START_SCENARIO_NAME + " failed"); } runScenario(executionToken, handlerManager, scenario, skip); } }
private void updateExecutionStats(ExecutionToken executionToken, ScenarioToken scenario) { if (scenario.getEndState() == EndState.PASSED) { executionToken.incrementScenariosPassed(); } else if (scenario.getEndState() == EndState.PENDING) { executionToken.incrementScenariosPending(); } else { executionToken.incrementScenariosFailed(); } }