Package net.thucydides.core.model
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestStep.TestStepBuilder
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Predicate<TestStep>
COMPROMISED_TESTSTEPS
static java.util.function.Predicate<TestStep>
ERROR_TESTSTEPS
static java.util.function.Predicate<TestStep>
FAILING_TESTSTEPS
static java.util.function.Predicate<TestStep>
IGNORED_TESTSTEPS
static TestStep
NO_STEP
static java.util.function.Predicate<TestStep>
SKIPPED_TESTSTEPS
static java.util.function.Predicate<TestStep>
SUCCESSFUL_TESTSTEPS
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description TestStep
addChildStep(TestStep step)
TestStep
addScreenshot(ScreenshotAndHtmlSource screenshotAndHtmlSource)
TestStep
asManual()
protected java.util.List<TestStep>
children()
void
clearException()
TestStep
clone()
protected TestStep
copyOfThisTestStep()
boolean
correspondsToLine(int lineNumber)
boolean
equals(java.lang.Object o)
void
failedWith(java.lang.Throwable cause)
Indicate that this step failed with a given error.static TestStep.TestStepBuilder
forStepCalled(java.lang.String description)
int
getActualScreenshotCount()
java.util.List<ScreenshotAndHtmlSource>
getAllScreenshots()
java.util.List<TestStep>
getChildren()
java.lang.String
getConciseErrorMessage()
java.lang.String
getDescription()
long
getDuration()
double
getDurationInSeconds()
Screenshot
getEarliestScreenshot()
java.lang.String
getError()
java.lang.String
getErrorMessage()
FailureCause
getException()
ExternalLink
getExternalLink()
ScreenshotAndHtmlSource
getFirstScreenshot()
java.util.List<? extends TestStep>
getFlattenedSteps()
java.lang.String
getFormattedDuration()
ScreenshotAndHtmlSource
getLastScreenshot()
Screenshot
getLatestScreenshot()
java.util.Collection<? extends TestStep>
getLeafTestSteps()
int
getLevel()
FailureCause
getNestedException()
int
getNumber()
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.java.util.List<ReportData>
getReportData()
java.util.List<ReportData>
getReportEvidence()
RestQuery
getRestQuery()
TestResult
getResult()
int
getScreenshotCount()
java.util.List<ScreenshotAndHtmlSource>
getScreenshots()
java.lang.String
getShortErrorMessage()
java.time.ZonedDateTime
getStartTime()
java.util.List<Screenshot>
getTopLevelScreenshots()
boolean
hasChildren()
boolean
hasData()
int
hashCode()
boolean
hasMultipleScreenshots()
boolean
hasNestedErrors()
boolean
hasRestQuery()
boolean
hasScreenshots()
boolean
isAGroup()
boolean
isAPrecondition()
java.lang.Boolean
isCompromised()
java.lang.Boolean
isError()
java.lang.Boolean
isFailure()
java.lang.Boolean
isIgnored()
java.lang.Boolean
isPending()
java.lang.Boolean
isSkipped()
java.lang.Boolean
isSuccessful()
boolean
needsScreenshots()
void
recordDuration()
TestStep
recordReportData(ReportData reportData)
void
recordRestQuery(RestQuery restQuery)
void
removeScreenshot(int index)
Screenshot
renderedScreenshotOf(ScreenshotAndHtmlSource from, int level)
int
renumberFrom(int count)
void
setDescription(java.lang.String description)
void
setDuration(long duration)
void
setExternalLink(ExternalLink externalLink)
void
setLineNumber(int lineNumber)
protected void
setNumber(int number)
void
setPrecondition(boolean precondition)
void
setResult(TestResult result)
Each test step has a result, indicating the outcome of this step.TestStep
startingAt(java.time.ZonedDateTime time)
void
testAborted(java.lang.Throwable exception)
The test has been aborted (marked as pending or ignored) for a reason described in the exception.java.lang.String
toString()
TestStep
unrendered()
void
updateOverallResult()
TestStep
withReportData(ReportData reportData)
TestStep
withResult(TestResult annotatedResult)
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
NO_STEP
-
IGNORED_TESTSTEPS
-
COMPROMISED_TESTSTEPS
-
SUCCESSFUL_TESTSTEPS
-
FAILING_TESTSTEPS
-
ERROR_TESTSTEPS
-
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
-
hasScreenshots
public boolean hasScreenshots() -
children
-
renumberFrom
public int renumberFrom(int count) -
recordRestQuery
-
updateOverallResult
public void updateOverallResult() -
setPrecondition
public void setPrecondition(boolean precondition) -
withResult
-
setLineNumber
public void setLineNumber(int lineNumber) -
correspondsToLine
public boolean correspondsToLine(int lineNumber) -
getExternalLink
-
setExternalLink
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
startingAt
-
clone
- Overrides:
clone
in classjava.lang.Object
-
copyOfThisTestStep
-
recordDuration
public void recordDuration() -
getNumber
public int getNumber() -
setDescription
public void setDescription(java.lang.String description) -
getDescription
public java.lang.String getDescription() -
unrendered
-
getChildren
-
getScreenshots
-
getAllScreenshots
-
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
-
renderedScreenshotOf
-
hasRestQuery
public boolean hasRestQuery() -
hasData
public boolean hasData() -
getRestQuery
-
getLevel
public int getLevel() -
getReportEvidence
-
getReportData
-
getFirstScreenshot
-
getEarliestScreenshot
-
getLatestScreenshot
-
getLastScreenshot
-
needsScreenshots
public boolean needsScreenshots() -
setResult
Each test step has a result, indicating the outcome of this step.- Parameters:
result
- The test outcome associated with this step.
-
getResult
-
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
-
clearException
public void clearException() -
getNestedException
-
getFlattenedSteps
-
isAGroup
public boolean isAGroup() -
hasNestedErrors
public boolean hasNestedErrors() -
addChildStep
-
hasChildren
public boolean hasChildren() -
hasMultipleScreenshots
public boolean hasMultipleScreenshots() -
getLeafTestSteps
-
addScreenshot
-
getStartTime
public java.time.ZonedDateTime getStartTime() -
getActualScreenshotCount
public int getActualScreenshotCount() -
getScreenshotCount
public int getScreenshotCount() -
removeScreenshot
public void removeScreenshot(int index) -
withReportData
-
recordReportData
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-