Class TestOutcomes

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

public class TestOutcomes extends 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

  • Method Details

    • withLabel

      public TestOutcomes withLabel(String label)
    • withResultFilter

      public TestOutcomes withResultFilter(TestResult testResult)
    • filteredByEnvironmentTags

      public TestOutcomes filteredByEnvironmentTags()
    • getEnvironmentVariables

      public EnvironmentVariables getEnvironmentVariables()
    • havingResult

      public TestOutcomes havingResult(String result)
    • havingResult

      public TestOutcomes havingResult(TestResult expectedResult)
    • getResultCount

      public long getResultCount()
    • getAllResults

      public List<TestResult> getAllResults()
    • getDistinctResults

      public Set<TestResult> getDistinctResults()
    • of

      public static TestOutcomes of(Collection<? extends TestOutcome> outcomes)
    • withNoResults

      public static TestOutcomes withNoResults()
    • getFlagCounts

      public Map<? extends Flag,Integer> getFlagCounts()
    • haveFlags

      public boolean haveFlags()
    • getFlags

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

      public Integer flagCountFor(Flag flag)
    • getLabel

      public String getLabel()
    • getTagTypes

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

      public List<String> getFirstClassTagTypes()
    • getRequirementTagTypes

      public List<String> getRequirementTagTypes()
    • getTagNames

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

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

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

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

      public List<TestTag> getTagsOfTypeExcluding(String tagType, String excludedTag)
    • getRootOutcomes

      public TestOutcomes getRootOutcomes()
    • directlyUnder

      public TestOutcomes directlyUnder(Requirement requirement)
    • forRequirement

      public TestOutcomes forRequirement(Requirement requirement)
    • getTestTag

      public TestTag getTestTag()
    • containsTag

      public boolean containsTag(TestTag testTag)
    • containsMatchingTag

      public boolean containsMatchingTag(TestTag containedTag)
    • getStartTime

      public Optional<ZonedDateTime> getStartTime()
    • ofType

      public TestOutcomes ofType(TestType testType)
    • scenarioCountWithResult

      public Integer scenarioCountWithResult(TestResult result)
    • withErrorType

      public TestOutcomes withErrorType(String testFailureErrorType)
    • countWithResult

      public long countWithResult(TestType expectedType, TestResult expectedResult)
    • countWithType

      public long countWithType(TestType expectedType)
    • withResult

      public TestOutcomes withResult(TestResult result)
    • withRequirementsTags

      public TestOutcomes withRequirementsTags()
    • testOutcomeWithName

      public Optional<? extends TestOutcome> testOutcomeWithName(String name)
    • testOutcomesWithName

      public List<TestOutcome> testOutcomesWithName(String name)
    • getFastestTestDuration

      public long getFastestTestDuration()
    • getSlowestTestDuration

      public long getSlowestTestDuration()
    • containTestFor

      public boolean containTestFor(Requirement requirement)
    • withTagType

      public TestOutcomes withTagType(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(List<String> tagTypes)
    • withTag

      public TestOutcomes withTag(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(String issueCardNumber)
    • withTags

      public TestOutcomes withTags(Collection<TestTag> tags)
    • getResultFilterName

      public 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
    • getAbortedTests

      public TestOutcomes getAbortedTests()
    • 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 List<? extends TestOutcome> getTests()
      Returns:
      The list of TestOutcomes contained in this test outcome set.
    • getTestCases

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

      public 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 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 List<? extends TestOutcome> getOutcomes()
    • getNumberOfTestScenarios

      public long getNumberOfTestScenarios()
    • 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(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(String testType)
    • count

      public OutcomeCounter count(TestType testType)
    • getProportion

      public TestOutcomes.OutcomeProportionCounter getProportion()
    • proportionOf

      public TestOutcomes.OutcomeProportionCounter proportionOf(String testType)
    • proportionOf

      public TestOutcomes.OutcomeProportionCounter proportionOf(TestType testType)
    • getPercentSteps

    • proportionalStepsOf

      public TestOutcomes.OutcomeProportionStepCounter proportionalStepsOf(String testType)
    • proportionalStepsOf

      public TestOutcomes.OutcomeProportionStepCounter proportionalStepsOf(TestType testType)
    • decimalPercentageSteps

      public TestOutcomes.OutcomeProportionStepCounter decimalPercentageSteps(String testType)
    • getFormattedPercentageSteps

      public TestCoverageFormatter.FormattedPercentageStepCoverage getFormattedPercentageSteps()
    • getFormattedPercentage

      public TestCoverageFormatter.FormattedPercentageCoverage getFormattedPercentage()
    • getFormattedPercentage

      public TestCoverageFormatter.FormattedPercentageCoverage getFormattedPercentage(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 long getTestCount()
    • getTestCaseCount

      public long getTestCaseCount()
      The test case count include all individual tests data-driven tests. A data-driven test counts as 1 test.
    • getScenarioCount

      public long getScenarioCount()
      The scenario count include all individual tests and rows in data-driven tests.
    • hasDataDrivenTests

      public boolean hasDataDrivenTests()
    • getTotalDataRows

      public int getTotalDataRows()
    • findMatchingTags

      public TestOutcomes.TestOutcomeMatcher findMatchingTags()
    • isEmpty

      public boolean isEmpty()
    • getPlatformContexts

      public List<String> getPlatformContexts()
    • getBrowserContexts

      public List<String> getBrowserContexts()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object