@Test
  public void a_test_step_with_successful_child_steps_is_successful() throws InterruptedException {
    TestStep step = new TestStep("a narrative description");
    step.addChildStep(successfulTestStepCalled("child step 1"));
    step.addChildStep(successfulTestStepCalled("child step 2"));
    step.addChildStep(successfulTestStepCalled("child step 3"));

    assertThat(step.getResult(), is(TestResult.SUCCESS));
  }
  @Test
  public void a_test_step_with_empty_child_steps_is_successful_unless_marked_as_pending()
      throws InterruptedException {
    TestStep step = new TestStep("a narrative description");
    step.addChildStep(new TestStep("child step 1"));
    step.addChildStep(new TestStep("child step 2"));
    step.addChildStep(new TestStep("child step 3"));

    assertThat(step.getResult(), is(TestResult.SUCCESS));
  }
  private void recordTestOutcomeAsSteps(TestOutcome testOutcome, TestOutcome scenarioOutcome) {
    TestStep nestedStep =
        TestStep.forStepCalled(testOutcome.getTitle()).withResult(testOutcome.getResult());
    List<TestStep> testSteps = testOutcome.getTestSteps();

    if (testOutcome.getTestFailureCause() != null) {
      nestedStep.failedWith(testOutcome.getTestFailureCause().toException());
    }

    if (!testSteps.isEmpty()) {
      for (TestStep nextStep : testSteps) {
        nextStep.setDescription(
            normalizeTestStepDescription(
                nextStep.getDescription(), scenarioOutcome.getTestSteps().size() + 1));
        nestedStep.addChildStep(nextStep);
      }
    }
    scenarioOutcome.recordStep(nestedStep);
  }
  private void recordTestOutcomeAsSteps(TestOutcome testOutcome, TestOutcome scenarioOutcome) {
    final String name = alternativeMethodName(testOutcome);
    TestStep nestedStep = TestStep.forStepCalled(name).withResult(testOutcome.getResult());
    List<TestStep> testSteps = testOutcome.getTestSteps();

    if (testOutcome.getTestFailureCause() != null) {
      nestedStep.failedWith(testOutcome.getTestFailureCause().toException());
    }

    if (!testSteps.isEmpty()) {
      for (TestStep nextStep : testSteps) {
        nextStep.setDescription(
            normalizeTestStepDescription(
                nextStep.getDescription(), scenarioOutcome.getTestSteps().size() + 1));
        nestedStep.addChildStep(nextStep);
        nestedStep.setDuration(nextStep.getDuration() + nestedStep.getDuration());
      }
    }

    if (nestedStep.getDuration() == 0) {
      nestedStep.setDuration(testOutcome.getDuration());
    }
    scenarioOutcome.recordStep(nestedStep);
  }