Class Element
- java.lang.Object
-
- com.trivago.cluecumber.engine.json.pojo.Element
-
public class Element extends Object
This represents a scenarios.
-
-
Constructor Summary
Constructors Constructor Description Element()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleananyAfterHookHasContent()Check if after hooks has content or an exception.booleananyBeforeHookHasContent()Determine if any before hooks contain data or an exception.List<ResultMatch>getAfter()Get the scenario's after hooks.List<ResultMatch>getAllResultMatches()Get all results from all background steps, steps and after hooks.List<Step>getAllStepsIncludingBackgroundSteps()Get all steps including background steps.List<Step>getBackgroundSteps()Get the scenario's background steps.List<ResultMatch>getBefore()Get the before hooks.List<Element>getChildrenElements()Get the children elements of this scenario.StringgetDescription()Get the scenario description.StringgetEndDateString()Get the end date of this scenario run.ZonedDateTimegetEndDateTime()Get the end time including a timezone.StringgetEndTimeString()Get the end time of this scenario run.intgetFeatureIndex()Get the internal feature index.StringgetFeatureName()Get the scenario's parent feature name.StringgetFeatureUri()Get the URI of the parent feature file.StringgetFirstException()Determine the first exception message in the stack trace to display on the scenario overview page.StringgetFirstExceptionClass()Determine the first exception class in the stack trace to display on the scenario overview page.StringgetId()Get the scenario's id.booleangetIsLastOfMultipleScenarioRuns()Check if this scenario is the last of multiple runs.booleangetIsNotLastOfMultipleScenarioRuns()Check if this scenario was run multiple times and it's not the last run.intgetLine()Get the starting line number of the scenario in the feature file.StringgetName()Get the scenario name.intgetScenarioIndex()Get the internal scenario index.StringgetStartDateString()Get the start date of this scenario run.ZonedDateTimegetStartDateTime()Get the start time including a timezone.StringgetStartTimestamp()Get the start timestamp.StringgetStartTimeString()Get the start time of this scenario run.StatusgetStatus()Get the overall scenario status based on its step results.List<Step>getSteps()Get the scenario's steps.List<Tag>getTags()Get the list of tags of this scenario.longgetTotalDuration()Get the total duration of this scenario.intgetTotalNumberOfFailedSteps()Get the total number of failed steps in this scenario.intgetTotalNumberOfPassedSteps()Get the total number of passed steps in this scenario.intgetTotalNumberOfSkippedSteps()Get the total number of skipped steps in this scenario.intgetTotalNumberOfSteps()Get the total number of steps in this scenario.StringgetType()Get the type of this element.booleanhasAttachments()Check if this scenario contains attachments.booleanhasDocStrings()Check if this scenario contains docstrings.booleanhasHooks()Check if this scenario has before or after hooks.booleanhasHooksWithContent()Check if this scenario contains any hooks with content.booleanhasOutputs()Check if this scenario contains outputs.booleanhasStepHooks()Check if this scenario contains hooks.booleanhasStepHooksWithContent()Check if any step hooks have content.booleanhasSubSections()Check if this scenario contains sub-sections.booleanisFailed()Check if this scenario failed.booleanisPassed()Check if this scenario passed.booleanisScenario()Determine if this is of type scenario.booleanisSkipped()Check if this scenario skipped.StringreturnTotalDurationString()Get the human-readable time string.voidsetAfter(List<ResultMatch> after)Set the scenario after hooksvoidsetBackgroundSteps(List<Step> steps)Set the background scenario steps.voidsetBefore(List<ResultMatch> before)Add before hooks.voidsetChildrenElements(List<Element> childrenElements)Set the children elements of this scenario.voidsetDescription(String description)Set the scenario description.voidsetFailOnPendingOrUndefined(boolean failOnPendingOrUndefined)Choose if a scenario should be failed on pending or undefined steps.voidsetFeatureIndex(int featureIndex)Set the internal feature index.voidsetFeatureName(String featureName)Set the scenario's parent feature name.voidsetFeatureUri(String featureUri)Set the URI of the parent feature file.voidsetId(String id)Set the scenario's id.voidsetIsLastOfMultipleScenarioRuns(boolean isLastOfMultipleScenarioRuns)Set to true if this scenario is the last of multiple runs.voidsetIsNotLastOfMultipleScenarioRuns(boolean isNotLastOfMultipleScenarioRuns)Set to true if this scenario was run multiple times and it's not the last run.voidsetLine(int line)Add the starting line number of this scenario within the feature file.voidsetName(String name)Add the scenario name.voidsetScenarioIndex(int scenarioIndex)Set the internal scenario index that is used for report links to scenario details.voidsetStartTimestamp(String startTimestamp)Set the scenario's start timestamp.voidsetSteps(List<Step> steps)Set the scenario steps.voidsetTags(List<Tag> tags)Set the scenario tags.voidsetType(String type)Set the type of this scenario element.
-
-
-
Method Detail
-
setTags
public void setTags(List<Tag> tags)
Set the scenario tags.- Parameters:
tags- The list of tags.
-
getStartTimestamp
public String getStartTimestamp()
Get the start timestamp.- Returns:
- The start timestamp.
-
setStartTimestamp
public void setStartTimestamp(String startTimestamp)
Set the scenario's start timestamp.- Parameters:
startTimestamp- The start timestamp.
-
getStartDateTime
public ZonedDateTime getStartDateTime()
Get the start time including a timezone.- Returns:
- The start time.
-
getEndDateTime
public ZonedDateTime getEndDateTime()
Get the end time including a timezone.- Returns:
- The start time.
-
getStartDateString
public String getStartDateString()
Get the start date of this scenario run.- Returns:
- The date.
-
getStartTimeString
public String getStartTimeString()
Get the start time of this scenario run.- Returns:
- The date.
-
getEndDateString
public String getEndDateString()
Get the end date of this scenario run.- Returns:
- The date.
-
getEndTimeString
public String getEndTimeString()
Get the end time of this scenario run.- Returns:
- The time.
-
getBefore
public List<ResultMatch> getBefore()
Get the before hooks.- Returns:
- The before hooks.
-
setBefore
public void setBefore(List<ResultMatch> before)
Add before hooks.- Parameters:
before- The list of before hooks.
-
anyBeforeHookHasContent
public boolean anyBeforeHookHasContent()
Determine if any before hooks contain data or an exception.- Returns:
- true if any before hooks contain data.
-
getLine
public int getLine()
Get the starting line number of the scenario in the feature file.- Returns:
- The scenario line number.
-
setLine
public void setLine(int line)
Add the starting line number of this scenario within the feature file.- Parameters:
line- the line number.
-
getName
public String getName()
Get the scenario name.- Returns:
- The scenario name.
-
setName
public void setName(String name)
Add the scenario name.- Parameters:
name- The scenario name.
-
getDescription
public String getDescription()
Get the scenario description.- Returns:
- The scenario description.
-
setDescription
public void setDescription(String description)
Set the scenario description.- Parameters:
description- The description.
-
getAfter
public List<ResultMatch> getAfter()
Get the scenario's after hooks.- Returns:
- The list of hooks.
-
setAfter
public void setAfter(List<ResultMatch> after)
Set the scenario after hooks- Parameters:
after- The list of hooks.
-
anyAfterHookHasContent
public boolean anyAfterHookHasContent()
Check if after hooks has content or an exception.- Returns:
- true if the after hook has content.
-
getType
public String getType()
Get the type of this element.- Returns:
- The string "scenario" or "background".
-
setType
public void setType(String type)
Set the type of this scenario element.- Parameters:
type- The string "scenario" or "background".
-
setSteps
public void setSteps(List<Step> steps)
Set the scenario steps.- Parameters:
steps- The list of steps.
-
getBackgroundSteps
public List<Step> getBackgroundSteps()
Get the scenario's background steps.- Returns:
- The background steps.
-
setBackgroundSteps
public void setBackgroundSteps(List<Step> steps)
Set the background scenario steps.- Parameters:
steps- The list of steps.
-
isScenario
public boolean isScenario()
Determine if this is of type scenario.- Returns:
- true if this is a scenario.
-
isFailed
public boolean isFailed()
Check if this scenario failed.- Returns:
- true if the status is failed.
-
isPassed
public boolean isPassed()
Check if this scenario passed.- Returns:
- true if the status is passed.
-
isSkipped
public boolean isSkipped()
Check if this scenario skipped.- Returns:
- true if the status is skipped.
-
getStatus
public Status getStatus()
Get the overall scenario status based on its step results.- Returns:
- The overall status.
-
getFirstExceptionClass
public String getFirstExceptionClass()
Determine the first exception class in the stack trace to display on the scenario overview page.- Returns:
- The exception class string.
-
getFirstException
public String getFirstException()
Determine the first exception message in the stack trace to display on the scenario overview page.- Returns:
- The exception message string.
-
getScenarioIndex
public int getScenarioIndex()
Get the internal scenario index.- Returns:
- The scenario index.
-
setScenarioIndex
public void setScenarioIndex(int scenarioIndex)
Set the internal scenario index that is used for report links to scenario details.- Parameters:
scenarioIndex- The scenario index.
-
getTotalNumberOfSteps
public int getTotalNumberOfSteps()
Get the total number of steps in this scenario.- Returns:
- The number of steps.
-
getTotalNumberOfPassedSteps
public int getTotalNumberOfPassedSteps()
Get the total number of passed steps in this scenario.- Returns:
- The number of passed steps.
-
getTotalNumberOfFailedSteps
public int getTotalNumberOfFailedSteps()
Get the total number of failed steps in this scenario.- Returns:
- The number of failed steps.
-
getTotalNumberOfSkippedSteps
public int getTotalNumberOfSkippedSteps()
Get the total number of skipped steps in this scenario.- Returns:
- The number of skipped steps.
-
getTotalDuration
public long getTotalDuration()
Get the total duration of this scenario.- Returns:
- the duration in nanoseconds.
-
returnTotalDurationString
public String returnTotalDurationString()
Get the human-readable time string.- Returns:
- the time string.
-
hasHooks
public boolean hasHooks()
Check if this scenario has before or after hooks.- Returns:
- true if there are before or after hooks.
-
hasHooksWithContent
public boolean hasHooksWithContent()
Check if this scenario contains any hooks with content.- Returns:
- true if there are hooks with content.
-
hasDocStrings
public boolean hasDocStrings()
Check if this scenario contains docstrings.- Returns:
- true if there are docstrings.
-
hasOutputs
public boolean hasOutputs()
Check if this scenario contains outputs.- Returns:
- true if there are outputs.
-
hasAttachments
public boolean hasAttachments()
Check if this scenario contains attachments.- Returns:
- true if there are attachments.
-
hasStepHooks
public boolean hasStepHooks()
Check if this scenario contains hooks.- Returns:
- true if there are hooks.
-
hasSubSections
public boolean hasSubSections()
Check if this scenario contains sub-sections.- Returns:
- true if there are sub-sections.
-
hasStepHooksWithContent
public boolean hasStepHooksWithContent()
Check if any step hooks have content.- Returns:
- true means that there are step hooks with content.
-
getAllResultMatches
public List<ResultMatch> getAllResultMatches()
Get all results from all background steps, steps and after hooks.- Returns:
- The results.
-
getFeatureName
public String getFeatureName()
Get the scenario's parent feature name.- Returns:
- The feature name.
-
setFeatureName
public void setFeatureName(String featureName)
Set the scenario's parent feature name.- Parameters:
featureName- The feature name.
-
getFeatureIndex
public int getFeatureIndex()
Get the internal feature index.- Returns:
- The feature index.
-
setFeatureIndex
public void setFeatureIndex(int featureIndex)
Set the internal feature index.- Parameters:
featureIndex- The feature index.
-
setFailOnPendingOrUndefined
public void setFailOnPendingOrUndefined(boolean failOnPendingOrUndefined)
Choose if a scenario should be failed on pending or undefined steps.- Parameters:
failOnPendingOrUndefined- If true, the scenario is failed on pending or undefined steps.
-
getFeatureUri
public String getFeatureUri()
Get the URI of the parent feature file.- Returns:
- The feature file URI.
-
getId
public String getId()
Get the scenario's id.- Returns:
- The string id.
-
setId
public void setId(String id)
Set the scenario's id.- Parameters:
id- The string id.
-
getIsLastOfMultipleScenarioRuns
public boolean getIsLastOfMultipleScenarioRuns()
Check if this scenario is the last of multiple runs.- Returns:
- true if this scenario is the last of multiple runs.
-
setIsLastOfMultipleScenarioRuns
public void setIsLastOfMultipleScenarioRuns(boolean isLastOfMultipleScenarioRuns)
Set to true if this scenario is the last of multiple runs.- Parameters:
isLastOfMultipleScenarioRuns- true if this scenario is the last of multiple runs.
-
getIsNotLastOfMultipleScenarioRuns
public boolean getIsNotLastOfMultipleScenarioRuns()
Check if this scenario was run multiple times and it's not the last run.- Returns:
- true if this scenario was run multiple times and it's not the last run.
-
setIsNotLastOfMultipleScenarioRuns
public void setIsNotLastOfMultipleScenarioRuns(boolean isNotLastOfMultipleScenarioRuns)
Set to true if this scenario was run multiple times and it's not the last run.- Parameters:
isNotLastOfMultipleScenarioRuns- true if this scenario was run multiple times and it's not the last run.
-
getChildrenElements
public List<Element> getChildrenElements()
Get the children elements of this scenario.- Returns:
- The children elements.
-
setChildrenElements
public void setChildrenElements(List<Element> childrenElements)
Set the children elements of this scenario.- Parameters:
childrenElements- The children elements.
-
setFeatureUri
public void setFeatureUri(String featureUri)
Set the URI of the parent feature file.- Parameters:
featureUri- The feature file URI.
-
-