log.debug("Failed to parse " + scenario.getDescription() + ", creating dummy node", t); scenarioNode = new BasicScenarioNode(scenario.getDescription(), null, Collections.<StepNode> emptyList(), Collections.<String> emptySet(), depth);
private ScenarioNode<? extends IExecutionNode> buildRunnableScenarioNode(final Scenario scenario, Set<String> inheritedTags, int depth) { ScenarioNode<?> scenarioNode = null; try { if (scenario.isOutline()) { scenarioNode = buildOutlineScenarioNode(scenario, inheritedTags, depth); } else { scenarioNode = buildBasicScenarioNode(scenario, null, inheritedTags, depth); } } catch (final Exception e) { // something has gone wrong parsing this scenario, no point // running it so mark it as failed now if (log.isDebugEnabled()) { log.debug("Failed to parse " + scenario.getDescription() + ", creating dummy node", e); } scenarioNode = new BasicScenarioNode(scenario.getDescription(), null, Collections.<StepNode>emptyList(), Collections.<String>emptySet(), depth); // ctor has side effects... eeeurgh! new SubstepExecutionFailure(e, scenarioNode, ExecutionResult.PARSE_FAILURE); if (parameters.isFailParseErrorsImmediately()) { throw new SubstepsConfigurationException(e); } } return scenarioNode; }
public BasicScenarioNode buildBasicScenarioNode(final Scenario scenario, final ExampleParameter scenarioParameters, Set<String> inheritedTags, int depth) { Set<String> allTags = Sets.newHashSet(); allTags.addAll(inheritedTags); if (scenario.getTags() != null) { allTags.addAll(scenario.getTags()); } SubstepNode background = scenario.hasBackground() ? substepNodeBuilder.build(scenario.getDescription(), scenario.getBackground().getSteps(), parameters.getSyntax().getSubStepsMap(), null, scenarioParameters, true, allTags, depth + 1) : null; List<StepNode> steps = Lists.newArrayList(); if (scenario.hasSteps()) { for (Step step : scenario.getSteps()) { steps.add(substepNodeBuilder.buildStepNode(scenario.getDescription(), step, parameters.getSyntax() .getSubStepsMap(), null, scenarioParameters, false, allTags, depth + 1)); } } return new BasicScenarioNode(scenario.getDescription(), background, steps, allTags, depth); }
public BasicScenarioNode buildBasicScenarioNode(final Scenario scenario, final ExampleParameter scenarioParameters, Set<String> inheritedTags, int depth) { Set<String> allTags = Sets.newHashSet(); allTags.addAll(inheritedTags); if (scenario.getTags() != null) { allTags.addAll(scenario.getTags()); } SubstepNode background = scenario.hasBackground() ? substepNodeBuilder.build(scenario.getDescription(), scenario.getBackground().getSteps(), parameters.getSyntax().getSubStepsMap(), null, scenarioParameters, true, allTags, depth + 1) : null; List<StepNode> steps = Lists.newArrayList(); if (scenario.hasSteps()) { for (Step step : scenario.getSteps()) { steps.add(substepNodeBuilder.buildStepNode(scenario.getDescription(), step, parameters.getSyntax().getSubStepsMap(), null, scenarioParameters, false, allTags, depth + 1)); } } String scenarioDescription = scenarioParameters == null ? scenario.getDescription() : SubstepNodeBuilder.substitutePlaceholders(scenario.getDescription(), scenarioParameters.getParameters()); return new BasicScenarioNode(scenarioDescription, background, steps, allTags, depth); }