Class CaseResult

    • Constructor Detail

      • CaseResult

        public CaseResult​(SuiteResult parent,
                          String testName,
                          String errorStackTrace)
        Used to create a fake failure, when Hudson fails to load data from XML files. Public since 1.526.
        Parameters:
        parent - Parent result.
        testName - Test name.
        errorStackTrace - Error stack trace.
    • Method Detail

      • getTransformedTestName

        public String getTransformedTestName()
      • getName

        @Exported(visibility=999)
        public String getName()
        Gets the name of the test, which is returned from TestCase.getName()

        Note that this may contain any URL-unfriendly character.

        Overrides:
        getName in class TestObject
        Returns:
        the name of this object.
      • getTitle

        public String getTitle()
        Gets the human readable title of this result object.
        Overrides:
        getTitle in class TestResult
        Returns:
        the human readable title of this result object.
      • getDuration

        @Exported(visibility=9)
        public float getDuration()
        Gets the duration of the test, in seconds
        Overrides:
        getDuration in class TestResult
        Returns:
        the time in seconds the test ran.
      • getStartTime

        public long getStartTime()
        Gets the start time of the test, in epoch milliseconds
      • getClassName

        @Exported(visibility=9)
        public String getClassName()
        Gets the class name of a test class.
        Returns:
        the class name of a test class.
      • getSimpleName

        public String getSimpleName()
        Gets the simple (not qualified) class name.
        Returns:
        the simple (not qualified) class name.
      • getPackageName

        public String getPackageName()
        Gets the package name of a test case.
        Returns:
        the package name of a test case.
      • getFullName

        public String getFullName()
        Description copied from class: TestObject
        Gets the full name of this object.
        Overrides:
        getFullName in class TestObject
        Returns:
        the full name of this object.
      • getTransformedFullDisplayName

        public String getTransformedFullDisplayName()
      • getFailCount

        public int getFailCount()
        Description copied from class: TestResult
        Gets the total number of failed tests.
        Overrides:
        getFailCount in class TestResult
        Returns:
        the total number of failed tests.
      • getSkipCount

        public int getSkipCount()
        Description copied from class: TestResult
        Gets the total number of skipped tests.
        Overrides:
        getSkipCount in class TestResult
        Returns:
        the total number of skipped tests.
      • getPassCount

        public int getPassCount()
        Description copied from class: TestResult
        Gets the total number of passed tests.
        Overrides:
        getPassCount in class TestResult
        Returns:
        the total number of passed tests.
      • getFailedSince

        @Exported(visibility=9)
        public int getFailedSince()
        If this test failed, then return the build number when this test started failing.
        Overrides:
        getFailedSince in class TestResult
        Returns:
        the build number when this test started failing.
      • getFailedSinceRun

        public Run<?,​?> getFailedSinceRun()
        Description copied from class: TestResult
        If this test failed, then return the run when this test started failing.
        Overrides:
        getFailedSinceRun in class TestResult
        Returns:
        the run when this test started failing.
      • getAge

        @Exported(visibility=9)
        public int getAge()
        Gets the number of consecutive builds (including this) that this test case has been failing.
        Returns:
        the number of consecutive failing builds.
      • getStdout

        @Exported
        public String getStdout()
        The stdout of this test.

        Depending on the tool that produced the XML report, this method works somewhat inconsistently. With some tools (such as Maven surefire plugin), you get the accurate information, that is the stdout from this test case. With some other tools (such as the JUnit task in Ant), this method returns the stdout produced by the entire test suite.

        If you need to know which is the case, compare this output from SuiteResult.getStdout().

        Overrides:
        getStdout in class TestResult
        Returns:
        the stdout of this test.
        Since:
        1.294
      • getStderr

        @Exported
        public String getStderr()
        The stderr of this test.
        Overrides:
        getStderr in class TestResult
        Returns:
        the stderr of this test.
        Since:
        1.294
        See Also:
        getStdout()
      • getFailedTests

        public Collection<? extends TestResult> getFailedTests()
        Gets the "children" of this test result that failed
        Overrides:
        getFailedTests in class TestResult
        Returns:
        the children of this test result, if any, or an empty collection
      • getPassedTests

        public Collection<? extends TestResult> getPassedTests()
        Gets the "children" of this test result that passed
        Overrides:
        getPassedTests in class TestResult
        Returns:
        the children of this test result, if any, or an empty collection
      • getSkippedTests

        public Collection<? extends TestResult> getSkippedTests()
        Gets the "children" of this test result that were skipped
        Overrides:
        getSkippedTests in class TestResult
        Returns:
        the children of this test result, if any, or an empty list
      • getErrorStackTrace

        @Exported
        public String getErrorStackTrace()
        If there was an error or a failure, this is the stack trace, or otherwise null.
        Overrides:
        getErrorStackTrace in class TestResult
        Returns:
        the stack trace of the error or failure.
      • getErrorDetails

        @Exported
        public String getErrorDetails()
        If there was an error or a failure, this is the text from the message.
        Overrides:
        getErrorDetails in class TestResult
        Returns:
        the message of the error or failure.
      • isPassed

        public boolean isPassed()
        Overrides:
        isPassed in class TestResult
        Returns:
        true if the test was not skipped and did not fail, false otherwise.
      • isSkipped

        @Exported(visibility=9)
        public boolean isSkipped()
        Tests whether the test was skipped or not. TestNG allows tests to be skipped if their dependencies fail or they are part of a group that has been configured to be skipped.
        Returns:
        true if the test was not executed, false otherwise.
      • isFailed

        public boolean isFailed()
        Returns:
        true if the test was not skipped and did not pass, false otherwise.
        Since:
        1.520
      • getSkippedMessage

        @Exported
        public String getSkippedMessage()
        Provides the reason given for the test being being skipped.
        Returns:
        the message given for a skipped test if one has been provided, null otherwise.
        Since:
        1.507
      • getFlowNodeId

        @CheckForNull
        public String getFlowNodeId()
      • getEnclosingFlowNodeIds

        @NonNull
        public List<String> getEnclosingFlowNodeIds()
      • getEnclosingFlowNodeNames

        @NonNull
        public List<String> getEnclosingFlowNodeNames()
      • getRun

        public Run<?,​?> getRun()
        Overrides:
        getRun in class TestObject
        Returns:
        the run in which this test was executed.
      • setParentSuiteResult

        public void setParentSuiteResult​(SuiteResult parent)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getStatus

        @Exported(name="status",
                  visibility=9)
        public CaseResult.Status getStatus()
      • setClass

        public void setClass​(ClassResult classResult)
      • setStartTime

        public void setStartTime​(long start)