final TestOutlineScenarioNodeBuilder outlineScenarioBuilder = featureBuilder.addOutlineScenario(scenarioName);
final TestOutlineScenarioRowNodeBuilder rowBuilder1 = outlineScenarioBuilder.addRow(1);
final TestOutlineScenarioRowNodeBuilder rowBuilder2 = outlineScenarioBuilder.addRow(2);
final TestBasicScenarioNodeBuilder row1ScenarioBuilder = rowBuilder1.setBasicScenario(scenarioName);
row1ScenarioBuilder.addStepImpl(getClass(), nonFailMethod).addStepImpl(getClass(), failMethod)
.addStepImpl(getClass(), nonFailMethod);
final TestBasicScenarioNodeBuilder row2ScenarioBuilder = rowBuilder2.setBasicScenario(scenarioName);
row2ScenarioBuilder.addStepImpls(3, getClass(), nonFailMethod);
final RootNode rootNode = rootNodeBuilder.build();
final ExecutionNodeRunner runner = new ExecutionNodeRunner();
final INotificationDistributor notificationDistributor = getPrivateField(runner, "notificationDistributor");
final SetupAndTearDown setupAndTearDown = mock(SetupAndTearDown.class);
final RootNodeExecutionContext nodeExecutionContext = new RootNodeExecutionContext(notificationDistributor,
Lists.<SubstepExecutionFailure> newArrayList(), setupAndTearDown, null, new ImplementationCache());
setPrivateField(runner, "rootNode", rootNode);
setPrivateField(runner, "nodeExecutionContext", nodeExecutionContext);
runner.run();
final List<SubstepExecutionFailure> failures = runner.getFailures();
Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));
Assert.assertThat(featureBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
Assert.assertThat(row1ScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
Assert.assertThat(row2ScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.PASSED));
Assert.assertThat(rowBuilder1.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
Assert.assertThat(rowBuilder2.getBuilt().getResult().getResult(), is(ExecutionResult.PASSED));
Assert.assertThat(outlineScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(0).getResult().getResult(),
is(ExecutionResult.PASSED));
Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(1).getResult().getResult(),
is(ExecutionResult.FAILED));
Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(2).getResult().getResult(),
is(ExecutionResult.NOT_RUN));
Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(0).getResult().getResult(),
is(ExecutionResult.PASSED));
Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(1).getResult().getResult(),
is(ExecutionResult.PASSED));
Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(2).getResult().getResult(),
is(ExecutionResult.PASSED));
Assert.assertFalse("expecting some failures", failures.isEmpty());
// just one failure for the actual step that failed