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 classTestStep.TestStepBuilder -
Field Summary
Fields Modifier and Type Field Description static java.util.function.Predicate<TestStep>COMPROMISED_TESTSTEPSstatic java.util.function.Predicate<TestStep>ERROR_TESTSTEPSstatic java.util.function.Predicate<TestStep>FAILING_TESTSTEPSstatic java.util.function.Predicate<TestStep>IGNORED_TESTSTEPSstatic TestStepNO_STEPstatic java.util.function.Predicate<TestStep>SKIPPED_TESTSTEPSstatic java.util.function.Predicate<TestStep>SUCCESSFUL_TESTSTEPS -
Constructor Summary
-
Method Summary
Modifier and Type Method Description TestStepaddChildStep(TestStep step)TestStepaddScreenshot(ScreenshotAndHtmlSource screenshotAndHtmlSource)TestStepasManual()protected java.util.List<TestStep>children()voidclearException()TestStepclone()protected TestStepcopyOfThisTestStep()booleancorrespondsToLine(int lineNumber)booleanequals(java.lang.Object o)voidfailedWith(java.lang.Throwable cause)Indicate that this step failed with a given error.static TestStep.TestStepBuilderforStepCalled(java.lang.String description)intgetActualScreenshotCount()java.util.List<ScreenshotAndHtmlSource>getAllScreenshots()java.util.List<TestStep>getChildren()java.lang.StringgetConciseErrorMessage()java.lang.StringgetDescription()longgetDuration()doublegetDurationInSeconds()ScreenshotgetEarliestScreenshot()java.lang.StringgetError()java.lang.StringgetErrorMessage()FailureCausegetException()ExternalLinkgetExternalLink()ScreenshotAndHtmlSourcegetFirstScreenshot()java.util.List<? extends TestStep>getFlattenedSteps()java.lang.StringgetFormattedDuration()ScreenshotAndHtmlSourcegetLastScreenshot()ScreenshotgetLatestScreenshot()java.util.Collection<? extends TestStep>getLeafTestSteps()intgetLevel()FailureCausegetNestedException()intgetNumber()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()RestQuerygetRestQuery()TestResultgetResult()intgetScreenshotCount()java.util.List<ScreenshotAndHtmlSource>getScreenshots()java.lang.StringgetShortErrorMessage()java.time.ZonedDateTimegetStartTime()java.util.List<Screenshot>getTopLevelScreenshots()booleanhasChildren()booleanhasData()inthashCode()booleanhasMultipleScreenshots()booleanhasNestedErrors()booleanhasRestQuery()booleanhasScreenshots()booleanisAGroup()booleanisAPrecondition()java.lang.BooleanisCompromised()java.lang.BooleanisError()java.lang.BooleanisFailure()java.lang.BooleanisIgnored()java.lang.BooleanisPending()java.lang.BooleanisSkipped()java.lang.BooleanisSuccessful()booleanneedsScreenshots()voidrecordDuration()TestSteprecordReportData(ReportData reportData)voidrecordRestQuery(RestQuery restQuery)voidremoveScreenshot(int index)ScreenshotrenderedScreenshotOf(ScreenshotAndHtmlSource from, int level)intrenumberFrom(int count)voidsetDescription(java.lang.String description)voidsetDuration(long duration)voidsetExternalLink(ExternalLink externalLink)voidsetLineNumber(int lineNumber)protected voidsetNumber(int number)voidsetPrecondition(boolean precondition)voidsetResult(TestResult result)Each test step has a result, indicating the outcome of this step.TestStepstartingAt(java.time.ZonedDateTime time)voidtestAborted(java.lang.Throwable exception)The test has been aborted (marked as pending or ignored) for a reason described in the exception.java.lang.StringtoString()TestStepunrendered()voidupdateOverallResult()TestStepwithReportData(ReportData reportData)TestStepwithResult(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:
toStringin classjava.lang.Object
-
startingAt
-
clone
- Overrides:
clonein 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-