Class Element


  • public class Element
    extends Object
    This represents a scenarios.
    • Constructor Detail

      • Element

        public Element()
    • Method Detail

      • getTags

        public List<Tag> getTags()
        Get the list of tags of this scenario.
        Returns:
        The tag list.
      • 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".
      • getSteps

        public List<Step> getSteps()
        Get the scenario's steps.
        Returns:
        The steps.
      • 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.
      • hasStepHooks

        public boolean hasStepHooks()
        Check if this scenario contains hooks.
        Returns:
        true if there are hooks.
      • 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.
      • setFeatureUri

        public void setFeatureUri​(String featureUri)
        Set the URI of the parent feature file.
        Parameters:
        featureUri - The feature file URI.