Class TestOutcomes

java.lang.Object
net.thucydides.core.reports.TestOutcomes

public class TestOutcomes
extends java.lang.Object
A set of test outcomes, which lets you perform query operations on the test outcomes. In particular, you can filter a set of test outcomes by tag type and by tag values. Since these operations also return TestOutcomes, you can then further drill down into the test outcome sets. The TestOutcomes object will usually return a list of TestOutcome objects. You can also inject statistics and test run history by using the withHistory() method. This will return a list of TestOutcomeWithHistory instances.
  • Constructor Details

    • TestOutcomes

      @Inject protected TestOutcomes​(java.util.Collection<? extends TestOutcome> outcomes, double estimatedAverageStepCount, java.lang.String label, TestTag testTag, TestResult resultFilter, TestOutcomes rootOutcomes, EnvironmentVariables environmentVariables)
    • TestOutcomes

      protected TestOutcomes​(java.util.Collection<? extends TestOutcome> outcomes, double estimatedAverageStepCount, java.lang.String label)
    • TestOutcomes

      protected TestOutcomes​(java.util.List<? extends TestOutcome> outcomes, double estimatedAverageStepCount, java.lang.String label, TestTag tag)
    • TestOutcomes

      protected TestOutcomes​(java.util.List<? extends TestOutcome> outcomes, double estimatedAverageStepCount, java.lang.String label, TestResult resultFilter)
    • TestOutcomes

      protected TestOutcomes​(java.util.Collection<? extends TestOutcome> outcomes, double estimatedAverageStepCount)
  • Method Details

    • withLabel

      public TestOutcomes withLabel​(java.lang.String label)
    • withResultFilter

      public TestOutcomes withResultFilter​(TestResult testResult)
    • filteredByEnvironmentTags

      public TestOutcomes filteredByEnvironmentTags()
    • getEnvironmentVariables

      public EnvironmentVariables getEnvironmentVariables()
    • havingResult

      public TestOutcomes havingResult​(java.lang.String result)
    • havingResult

      public TestOutcomes havingResult​(TestResult result)
    • of

      public static TestOutcomes of​(java.util.Collection<? extends TestOutcome> outcomes)
    • withNoResults

      public static TestOutcomes withNoResults()
    • getFlagCounts

      public java.util.Map<? extends Flag,​java.lang.Integer> getFlagCounts()
    • haveFlags

      public boolean haveFlags()
    • getFlags

      public java.util.Set<? extends Flag> getFlags()
    • flagCountFor

      public java.lang.Integer flagCountFor​(Flag flag)
    • getLabel

      public java.lang.String getLabel()
    • getTagTypes

      public java.util.List<java.lang.String> getTagTypes()
      Returns:
      The list of all of the different tag types that appear in the test outcomes.
    • getFirstClassTagTypes

      public java.util.List<java.lang.String> getFirstClassTagTypes()
    • getRequirementTagTypes

      public java.util.List<java.lang.String> getRequirementTagTypes()
    • getTagNames

      public java.util.List<java.lang.String> getTagNames()
      Returns:
      The list of all the names of the different tags in these test outcomes
    • getTags

      public java.util.List<TestTag> getTags()
      Returns:
      The list of all the different tags in these test outcomes
    • getTagsOfType

      public java.util.List<TestTag> getTagsOfType​(java.lang.String tagType)
      Returns:
      The list of all the tags associated with a given tag type.
    • getMostSpecificTagsOfType

      public java.util.List<TestTag> getMostSpecificTagsOfType​(java.lang.String tagType)
      Returns:
      The list of all the tags associated with a given tag type.
    • getTagsOfTypeExcluding

      public java.util.List<TestTag> getTagsOfTypeExcluding​(java.lang.String tagType, java.lang.String excludedTag)
    • getRootOutcomes

      public TestOutcomes getRootOutcomes()
    • forRequirement

      public TestOutcomes forRequirement​(Requirement requirement)
    • getTestTag

      public TestTag getTestTag()
    • containsTag

      public boolean containsTag​(TestTag testTag)
    • containsMatchingTag

      public boolean containsMatchingTag​(TestTag containedTag)
    • getStartTime

      public java.util.Optional<java.time.ZonedDateTime> getStartTime()
    • ofType

      public TestOutcomes ofType​(TestType testType)
    • scenarioCountWithResult

      public java.lang.Integer scenarioCountWithResult​(TestResult result)
    • withErrorType

      public TestOutcomes withErrorType​(java.lang.String testFailureErrorType)
    • withResult

      public TestOutcomes withResult​(TestResult result)
    • withRequirementsTags

      public TestOutcomes withRequirementsTags()
    • testOutcomeWithName

      public java.util.Optional<? extends TestOutcome> testOutcomeWithName​(java.lang.String name)
    • testOutcomesWithName

      public java.util.List<TestOutcome> testOutcomesWithName​(java.lang.String name)
    • getFastestTestDuration

      public long getFastestTestDuration()
    • getSlowestTestDuration

      public long getSlowestTestDuration()
    • containTestFor

      public boolean containTestFor​(Requirement requirement)
    • withTagType

      public TestOutcomes withTagType​(java.lang.String tagType)
      Find the test outcomes with a given tag type
      Parameters:
      tagType - the tag type we are filtering on
      Returns:
      A new set of test outcomes for this tag type
    • withTagTypes

      public TestOutcomes withTagTypes​(java.util.List<java.lang.String> tagTypes)
    • withTag

      public TestOutcomes withTag​(java.lang.String tagName)
      Find the test outcomes with a given tag name
      Parameters:
      tagName - the name of the tag type we are filtering on
      Returns:
      A new set of test outcomes for this tag name
    • withTag

      public TestOutcomes withTag​(TestTag tag)
    • withCardNumber

      public TestOutcomes withCardNumber​(java.lang.String issueCardNumber)
    • withTags

      public TestOutcomes withTags​(java.util.Collection<TestTag> tags)
    • getResultFilterName

      public java.lang.String getResultFilterName()
    • getUnsuccessfulTests

      public TestOutcomes getUnsuccessfulTests()
    • getFailingTests

      public TestOutcomes getFailingTests()
      Find the failing test outcomes in this set
      Returns:
      A new set of test outcomes containing only the failing tests
    • getErrorTests

      public TestOutcomes getErrorTests()
    • getCompromisedTests

      public TestOutcomes getCompromisedTests()
    • getPassingTests

      public TestOutcomes getPassingTests()
      Find the successful test outcomes in this set
      Returns:
      A new set of test outcomes containing only the successful tests
    • getPendingTests

      public TestOutcomes getPendingTests()
      Find the pending or ignored test outcomes in this set
      Returns:
      A new set of test outcomes containing only the pending or ignored tests
    • getTests

      public java.util.List<? extends TestOutcome> getTests()
      Returns:
      The list of TestOutcomes contained in this test outcome set.
    • getDuration

      public java.lang.Long getDuration()
      Returns:
      The total duration of all of the tests in this set in milliseconds.
    • getDurationInSeconds

      public double getDurationInSeconds()
      Returns:
      The total duration of all of the tests in this set in milliseconds.
    • getResultTypeLabel

      public java.lang.String getResultTypeLabel()
    • getTotal

      public int getTotal()
      Returns:
      The total number of test runs in this set (including rows in data-driven tests).
    • getTotalMatchingScenarios

      public int getTotalMatchingScenarios()
    • getTotalTestScenarios

      public int getTotalTestScenarios()
      The total number of test scenarios (a data-driven test is counted as one test scenario).
    • getOutcomes

      public java.util.List<? extends TestOutcome> getOutcomes()
    • getResult

      public TestResult getResult()
      Returns:
      The overall result for the tests in this test outcome set.
    • getStepCount

      public int getStepCount()
      Returns:
      The total number of nested steps in these test outcomes.
    • successCount

      public int successCount​(java.lang.String testType)
      Parameters:
      testType - 'manual' or 'automated' (this is a string because it is mainly called from the freemarker templates
    • getTotalTests

      public OutcomeCounter getTotalTests()
    • getTotalScenarios

      public ScenarioOutcomeCounter getTotalScenarios()
    • count

      public OutcomeCounter count​(java.lang.String testType)
    • count

      public OutcomeCounter count​(TestType testType)
    • getProportion

      public TestOutcomes.OutcomeProportionCounter getProportion()
    • proportionOf

      public TestOutcomes.OutcomeProportionCounter proportionOf​(java.lang.String testType)
    • proportionOf

      public TestOutcomes.OutcomeProportionCounter proportionOf​(TestType testType)
    • getPercentSteps

    • proportionalStepsOf

      public TestOutcomes.OutcomeProportionStepCounter proportionalStepsOf​(java.lang.String testType)
    • proportionalStepsOf

      public TestOutcomes.OutcomeProportionStepCounter proportionalStepsOf​(TestType testType)
    • decimalPercentageSteps

      public TestOutcomes.OutcomeProportionStepCounter decimalPercentageSteps​(java.lang.String testType)
    • getFormattedPercentageSteps

      public TestCoverageFormatter.FormattedPercentageStepCoverage getFormattedPercentageSteps()
    • getFormattedPercentage

      public TestCoverageFormatter.FormattedPercentageCoverage getFormattedPercentage()
    • getFormattedPercentage

      public TestCoverageFormatter.FormattedPercentageCoverage getFormattedPercentage​(java.lang.String testType)
    • getFormattedPercentage

      public TestCoverageFormatter.FormattedPercentageCoverage getFormattedPercentage​(TestType testType)
    • getFormatted

      public TestCoverageFormatter getFormatted()
      Returns:
      Formatted version of the test coverage metrics
    • countTestsWithResult

      protected int countTestsWithResult​(TestResult expectedResult, TestType testType)
    • getAverageTestSize

      public double getAverageTestSize()
    • getTestCount

      public int getTestCount()
    • hasDataDrivenTests

      public boolean hasDataDrivenTests()
    • getTotalDataRows

      public int getTotalDataRows()
    • findMatchingTags

      public TestOutcomes.TestOutcomeMatcher findMatchingTags()