@Override protected boolean execute(FeatureNode node, RootNodeExecutionContext context) { log.info("Executing feature {}", node.getDescription()); this.context = context; boolean success = addExpectedChildrenFailureIfNoChildren(node, node.getChildren(), context); for (ScenarioNode<?> scenario : node.getChildren()) { success &= scenario.dispatch(this); } return success; }
private FeatureNode buildRunnableFeatureNode(FeatureFile featureFile) { List<ScenarioNode<?>> scenarioNodes = Lists.newArrayListWithExpectedSize(featureFile.getScenarios().size()); Set<String> tags = featureFile.getTags() != null ? featureFile.getTags() : Collections.<String>emptySet(); for (final Scenario scenario : featureFile.getScenarios()) { if (scenario != null) { ScenarioNode<?> scenarioNode = scenarioNodeBuilder.build(scenario, tags, _2); if (scenarioNode != null) { scenarioNodes.add(scenarioNode); } } } final Feature feature = new Feature(featureFile.getName(), featureFile.getSourceFile().getName()); final FeatureNode featureNode = new FeatureNode(feature, scenarioNodes, tags); featureNode.setFileUri(featureFile.getSourceFile().getAbsolutePath()); featureNode.setLineNumber(0); return featureNode; }
@Override public <RETURN_TYPE> List<RETURN_TYPE> accept(ExecutionNodeVisitor<RETURN_TYPE> executionNodeVisitor) { List<RETURN_TYPE> toReturn = Lists.newArrayList(); toReturn.add(executionNodeVisitor.visit(this)); for (FeatureNode feature : getChildren()) { toReturn.addAll(feature.accept(executionNodeVisitor)); } return toReturn; }
@Override public <RETURN_TYPE> List<RETURN_TYPE> accept(final ExecutionNodeVisitor<RETURN_TYPE> executionNodeVisitor) { final List<RETURN_TYPE> toReturn = Lists.newArrayList(); toReturn.add(executionNodeVisitor.visit(this)); for (final ScenarioNode<?> scenario : getChildren()) { toReturn.addAll(scenario.accept(executionNodeVisitor)); } return toReturn; }
for (FeatureNode featureNode : node.getChildren()) { if (FeatureNode.hasCriticalFailure(featureNode)){ if (FeatureNode.hasNonCriticalFailure(featureNode)){ SubstepsRuntimeException e = new SubstepsRuntimeException("At least one NON critical Feature failed"); SubstepExecutionFailure.setResult(e, node, ExecutionResult.NON_CRITICAL_FAILURE);
public static boolean hasCriticalFailure(ExecutionNode node) { boolean rtn = false; if (node.getResult().getResult() == ExecutionResult.CHILD_FAILED){ // there is a failure at a parent level, is the cause critical ? // any child nodes with failures that are critical ? if (node instanceof NodeWithChildren){ List<ExecutionNode> children = ((NodeWithChildren) node).getChildren(); for (ExecutionNode child : children){ rtn = hasCriticalFailure(child); if (rtn){ break; } } } } else if (node.getResult().getResult() == ExecutionResult.FAILED) { // real failure, is it critical ? rtn = !node.getResult().getFailure().isNonCritical(); } return rtn; }
public static boolean hasNonCriticalFailure(ExecutionNode node) { // TODO boolean rtn = false; if (node.getResult().getResult() == ExecutionResult.CHILD_FAILED){ // there is a failure at a parent level, is the cause critical ? // any child nodes with failures that are critical ? if (node instanceof NodeWithChildren){ List<ExecutionNode> children = ((NodeWithChildren) node).getChildren(); for (ExecutionNode child : children){ rtn = hasNonCriticalFailure(child); if (rtn){ break; } } } } else if (node.getResult().getResult() == ExecutionResult.NON_CRITICAL_FAILURE) { // real failure, is it critical ? rtn = node.getResult().getFailure().isNonCritical(); } return rtn; }
private void buildStatsForRootNode(RootNode rootNode) { for (FeatureNode featureNode : rootNode.getChildren()) { buildStatsForFeatureNode(featureNode); for (ScenarioNode<?> scenarioNode : featureNode.getChildren()) { buildStatsForScenarioNode(scenarioNode); } } }
private FeatureNode buildRunnableFeatureNode(FeatureFile featureFile) { List<ScenarioNode<?>> scenarioNodes = Lists.newArrayListWithExpectedSize(featureFile.getScenarios().size()); Set<String> tags = featureFile.getTags() != null ? featureFile.getTags() : Collections.<String> emptySet(); for (final Scenario scenario : featureFile.getScenarios()) { if (scenario != null) { ScenarioNode<?> scenarioNode = scenarioNodeBuilder.build(scenario, tags, _2); if (scenarioNode != null) { scenarioNodes.add(scenarioNode); } } } final Feature feature = new Feature(featureFile.getName(), featureFile.getSourceFile().getName()); final FeatureNode featureNode = new FeatureNode(feature, scenarioNodes, tags); featureNode.setFileUri(featureFile.getSourceFile().getAbsolutePath()); featureNode.setLineNumber(0); return featureNode; }
@Override protected boolean execute(FeatureNode node, RootNodeExecutionContext context) { log.info("Executing feature {}", node.getDescription()); this.context = context; boolean success = addExpectedChildrenFailureIfNoChildren(node, node.getChildren(), context); for (ScenarioNode<?> scenario : node.getChildren()) { success &= scenario.dispatch(this); } return success; }
private void buildCallHierarchy() { final ExecutionNodeUsage rootUsage = new ExecutionNodeUsage(this.rootNode); callerHierarchy.put(rootUsage, null); // nothing calls this for (final FeatureNode feature : this.rootNode.getChildren()) { addToCallHierarchy(feature); for (final ScenarioNode scenario : feature.getChildren()) { addToCallHierarchy(scenario); processChildrenForCallHierarchy(scenario.getChildren()); } } }
private void buildCallHierarchy() { final ExecutionNodeUsage rootUsage = new ExecutionNodeUsage(this.rootNode); callerHierarchy.put(rootUsage, null); // nothing calls this for (final FeatureNode feature : this.rootNode.getChildren()){ addToCallHierarchy(feature); for (final ScenarioNode scenario : feature.getChildren()){ addToCallHierarchy(scenario); processChildrenForCallHierarchy(scenario.getChildren()); } } }