/** Add a test step to this acceptance test. */ public void recordStep(final TestStep step) { checkNotNull(step.getDescription(), "The test step description was not defined."); if (inGroup()) { getCurrentStepGroup().addChildStep(step); } else { testSteps.add(step); } }
public List<Screenshot> getScreenshots() { List<Screenshot> screenshots = new ArrayList<Screenshot>(); List<TestStep> testSteps = getFlattenedTestSteps(); for (TestStep currentStep : testSteps) { if (!currentStep.isAGroup() && currentStep.getScreenshots() != null) { for (RecordedScreenshot screenshot : currentStep.getScreenshots()) { screenshots.add( new Screenshot( screenshot.getScreenshot().getName(), currentStep.getDescription(), widthOf(screenshot.getScreenshot()), currentStep.getException())); } } } return ImmutableList.copyOf(screenshots); }
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); }
@Test public void the_test_step_has_a_description() { TestStep step = new TestStep("a narrative description"); assertThat(step.getDescription(), is("a narrative description")); }