@Test
 public void we_can_record_the_lifetime_of_a_test_step() throws InterruptedException {
   TestStep step = new TestStep("a narrative description");
   Thread.sleep(150);
   step.recordDuration();
   assertThat(step.getDuration(), is(greaterThanOrEqualTo(100L)));
 }
 @Test
 public void we_can_display_the_lifetime_of_a_test_step_in_seconds() throws InterruptedException {
   TestStep step = new TestStep("a narrative description");
   Thread.sleep(150);
   step.recordDuration();
   double expectedDuration = step.getDuration() / 1000.0;
   assertThat(step.getDurationInSeconds(), closeTo(expectedDuration, 0.01));
 }
  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);
  }