java.lang.Object
net.thucydides.model.domain.TestStep
All Implemented Interfaces:
Cloneable

public class TestStep extends Object implements Cloneable
An acceptance test run is made up of test steps. Test steps can be either concrete steps or groups of steps. Each concrete step should represent an action by the user, and (generally) an expected outcome. A test step is described by a narrative-style phrase (e.g. "the user clicks on the 'Search' button', "the user fills in the registration form', etc.). A screenshot is stored for each step.
Author:
johnsmart
  • Field Details

  • Constructor Details

    • TestStep

      public TestStep()
    • TestStep

      public TestStep(String description)
    • TestStep

      public TestStep(ZonedDateTime startTime, String description)
  • Method Details

    • setNumber

      protected void setNumber(int number)
    • forStepCalled

      public static TestStep.TestStepBuilder forStepCalled(String description)
    • hasScreenshots

      public boolean hasScreenshots()
    • children

      protected List<TestStep> children()
    • renumberFrom

      public int renumberFrom(int count)
    • recordRestQuery

      public void recordRestQuery(RestQuery restQuery)
    • updateOverallResult

      public void updateOverallResult()
    • setPrecondition

      public void setPrecondition(boolean precondition)
    • withResult

      public TestStep withResult(TestResult annotatedResult)
    • setLineNumber

      public void setLineNumber(int lineNumber)
    • correspondsToLine

      public boolean correspondsToLine(int lineNumber)
    • getExternalLink

      public ExternalLink getExternalLink()
    • setExternalLink

      public void setExternalLink(ExternalLink externalLink)
    • setStartTime

      public void setStartTime(ZonedDateTime startTime)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • startingAt

      public TestStep startingAt(ZonedDateTime time)
    • clone

      public TestStep clone()
      Overrides:
      clone in class Object
    • copyOfThisTestStep

      protected TestStep copyOfThisTestStep()
    • recordDuration

      public void recordDuration(ZonedDateTime time)
    • recordDuration

      public void recordDuration()
    • getNumber

      public int getNumber()
    • setDescription

      public void setDescription(String description)
    • getDescription

      public String getDescription()
    • unrendered

      public TestStep unrendered()
    • getChildren

      public List<TestStep> getChildren()
    • getScreenshots

      public List<ScreenshotAndHtmlSource> getScreenshots()
    • getAllScreenshots

      public List<ScreenshotAndHtmlSource> getAllScreenshots()
    • getRenderedScreenshots

      public List<Screenshot> getRenderedScreenshots()
      Returns rendered screenshots of this step and of child steps, in order of appearance, and starting with the earliet screenshot overall with the name of this step.
    • getTopLevelScreenshots

      public List<Screenshot> getTopLevelScreenshots()
    • renderedScreenshotOf

      public Screenshot renderedScreenshotOf(ScreenshotAndHtmlSource from, int level)
    • hasRestQuery

      public boolean hasRestQuery()
    • hasData

      public boolean hasData()
    • getRestQuery

      public RestQuery getRestQuery()
    • getLevel

      public int getLevel()
    • getReportEvidence

      public List<ReportData> getReportEvidence()
    • getReportData

      public List<ReportData> getReportData()
    • getFirstScreenshot

      public ScreenshotAndHtmlSource getFirstScreenshot()
    • getEarliestScreenshot

      public Screenshot getEarliestScreenshot()
    • getLatestScreenshot

      public Screenshot getLatestScreenshot()
    • getLastScreenshot

      public ScreenshotAndHtmlSource getLastScreenshot()
    • needsScreenshots

      public boolean needsScreenshots()
    • setResult

      public void setResult(TestResult result)
      Each test step has a result, indicating the outcome of this step.
      Parameters:
      result - The test outcome associated with this step.
    • getResult

      public TestResult getResult()
    • getOverallResult

      public TestResult getOverallResult()
    • asManual

      public TestStep asManual()
    • isSuccessful

      public Boolean isSuccessful()
    • isFailure

      public Boolean isFailure()
    • isError

      public Boolean isError()
    • isCompromised

      public Boolean isCompromised()
    • isIgnored

      public Boolean isIgnored()
    • isSkipped

      public Boolean isSkipped()
    • isPending

      public Boolean isPending()
    • isAPrecondition

      public boolean isAPrecondition()
    • setDuration

      public void setDuration(long duration)
    • getDuration

      public long getDuration()
    • getDurationInSeconds

      public double getDurationInSeconds()
    • getFormattedDuration

      public String getFormattedDuration()
    • failedWith

      public void failedWith(Throwable cause)
      Indicate that this step failed with a given error.
      Parameters:
      cause - why the test failed.
    • getError

      public String getError()
    • getErrorMessage

      public String getErrorMessage()
    • getConciseErrorMessage

      public String getConciseErrorMessage()
    • testAborted

      public void testAborted(Throwable exception)
      The test has been aborted (marked as pending or ignored) for a reason described in the exception.
    • getShortErrorMessage

      public String getShortErrorMessage()
    • getException

      public FailureCause getException()
    • clearException

      public void clearException()
    • getNestedException

      public FailureCause getNestedException()
    • getFlattenedSteps

      public List<? extends TestStep> getFlattenedSteps()
    • isAGroup

      public boolean isAGroup()
    • hasNestedErrors

      public boolean hasNestedErrors()
    • addChildStep

      public TestStep addChildStep(TestStep step)
    • hasChildren

      public boolean hasChildren()
    • hasMultipleScreenshots

      public boolean hasMultipleScreenshots()
    • getLeafTestSteps

      public Collection<? extends TestStep> getLeafTestSteps()
    • addScreenshot

      public TestStep addScreenshot(ScreenshotAndHtmlSource screenshotAndHtmlSource)
    • getStartTime

      public ZonedDateTime getStartTime()
    • getActualScreenshotCount

      public int getActualScreenshotCount()
    • getScreenshotCount

      public int getScreenshotCount()
    • removeScreenshot

      public void removeScreenshot(int index)
    • withReportData

      public TestStep withReportData(ReportData reportData)
    • recordReportData

      public TestStep recordReportData(ReportData reportData)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object