Class TestStep

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

public class TestStep
extends java.lang.Object
implements java.lang.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

    • NO_STEP

      public static final TestStep NO_STEP
    • IGNORED_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> IGNORED_TESTSTEPS
    • COMPROMISED_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> COMPROMISED_TESTSTEPS
    • SUCCESSFUL_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> SUCCESSFUL_TESTSTEPS
    • FAILING_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> FAILING_TESTSTEPS
    • ERROR_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> ERROR_TESTSTEPS
    • SKIPPED_TESTSTEPS

      public static final java.util.function.Predicate<TestStep> SKIPPED_TESTSTEPS
  • Constructor Details

    • TestStep

      public TestStep()
    • TestStep

      public TestStep​(java.lang.String description)
    • TestStep

      public TestStep​(java.time.ZonedDateTime startTime, java.lang.String description)
  • Method Details

    • setNumber

      protected void setNumber​(int number)
    • forStepCalled

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

      public boolean hasScreenshots()
    • children

      protected java.util.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)
    • toString

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

      public TestStep startingAt​(java.time.ZonedDateTime time)
    • clone

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

      protected TestStep copyOfThisTestStep()
    • recordDuration

      public void recordDuration()
    • getNumber

      public int getNumber()
    • setDescription

      public void setDescription​(java.lang.String description)
    • getDescription

      public java.lang.String getDescription()
    • unrendered

      public TestStep unrendered()
    • getChildren

      public java.util.List<TestStep> getChildren()
    • getScreenshots

      public java.util.List<ScreenshotAndHtmlSource> getScreenshots()
    • getAllScreenshots

      public java.util.List<ScreenshotAndHtmlSource> getAllScreenshots()
    • getRenderedScreenshots

      public java.util.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 java.util.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 java.util.List<ReportData> getReportEvidence()
    • getReportData

      public java.util.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()
    • asManual

      public TestStep asManual()
    • isSuccessful

      public java.lang.Boolean isSuccessful()
    • isFailure

      public java.lang.Boolean isFailure()
    • isError

      public java.lang.Boolean isError()
    • isCompromised

      public java.lang.Boolean isCompromised()
    • isIgnored

      public java.lang.Boolean isIgnored()
    • isSkipped

      public java.lang.Boolean isSkipped()
    • isPending

      public java.lang.Boolean isPending()
    • isAPrecondition

      public boolean isAPrecondition()
    • setDuration

      public void setDuration​(long duration)
    • getDuration

      public long getDuration()
    • getDurationInSeconds

      public double getDurationInSeconds()
    • getFormattedDuration

      public java.lang.String getFormattedDuration()
    • failedWith

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

      public java.lang.String getError()
    • getErrorMessage

      public java.lang.String getErrorMessage()
    • getConciseErrorMessage

      public java.lang.String getConciseErrorMessage()
    • testAborted

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

      public java.lang.String getShortErrorMessage()
    • getException

      public FailureCause getException()
    • clearException

      public void clearException()
    • getNestedException

      public FailureCause getNestedException()
    • getFlattenedSteps

      public java.util.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 java.util.Collection<? extends TestStep> getLeafTestSteps()
    • addScreenshot

      public TestStep addScreenshot​(ScreenshotAndHtmlSource screenshotAndHtmlSource)
    • getStartTime

      public java.time.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​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object