hudson.tasks.junit
Class CaseResult

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.tasks.junit.TestObject
          extended by hudson.tasks.test.TestObject
              extended by hudson.tasks.test.TestResult
                  extended by hudson.tasks.junit.CaseResult
All Implemented Interfaces:
ModelObject, SearchableModelObject, SearchItem, Serializable, Comparable<CaseResult>

public final class CaseResult
extends TestResult
implements Comparable<CaseResult>

One test result.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Nested Class Summary
static class CaseResult.Status
          Constants that represent the status of this test.
 
Method Summary
 int compareTo(CaseResult that)
           
 TestResult findCorrespondingResult(String id)
          Case results have no children
 void freeze(SuiteResult parent)
           
 int getAge()
          Gets the number of consecutive builds (including this) that this test case has been failing.
 String getClassName()
          Gets the class name of a test class.
 String getDisplayName()
           
 float getDuration()
          Gets the duration of the test, in seconds
 String getErrorDetails()
          If there was an error or a failure, this is the text from the message.
 String getErrorStackTrace()
          If there was an error or a failure, this is the stack trace, or otherwise null.
 int getFailCount()
          Gets the total number of failed tests.
 int getFailedSince()
          If this test failed, then return the build number when this test started failing.
 Run<?,?> getFailedSinceRun()
          If this test failed, then return the run when this test started failing.
 Collection<? extends TestResult> getFailedTests()
          Gets the "children" of this test result that failed
 String getFullName()
           
 String getName()
          Gets the name of the test, which is returned from TestCase.getName()
 AbstractBuild<?,?> getOwner()
           
 String getPackageName()
          Gets the package name of a test case
 ClassResult getParent()
          Reverse pointer of TabulatedResult.getChildren().
 int getPassCount()
          Gets the total number of passed tests.
 Collection<? extends TestResult> getPassedTests()
          Gets the "children" of this test result that passed
 CaseResult getPreviousResult()
          Gets the counter part of this TestResult in the previous run.
 String getSafeName()
          Gets the version of getName() that's URL-safe.
 String getSimpleName()
          Gets the simple (not qualified) class name.
 int getSkipCount()
          Gets the total number of skipped tests.
 String getSkippedMessage()
          Provides the reason given for the test being being skipped.
 Collection<? extends TestResult> getSkippedTests()
          Gets the "children" of this test result that were skipped
 CaseResult.Status getStatus()
           
 String getStderr()
          The stderr of this test.
 String getStdout()
          The stdout of this test.
 SuiteResult getSuiteResult()
           
 String getTitle()
          Gets the human readable title of this result object.
 boolean isPassed()
           
 boolean isSkipped()
          Tests whether the test was skipped or not.
 void setParentSuiteResult(SuiteResult parent)
           
 
Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getParentAction, getResultInBuild, setParent, setParentAction, tally, toPrettyString
 
Methods inherited from class hudson.tasks.test.TestObject
doSubmitDescription, getApi, getDescription, getDurationString, getDynamic, getHistory, getId, getRelativePathFrom, getSearchUrl, getTestAction, getTestActions, getTestResult, getTestResultAction, getTopLevelTestResult, getTotalCount, getUrl, safe, setDescription, uniquifyName
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParent

public ClassResult getParent()
Description copied from class: TestObject
Reverse pointer of TabulatedResult.getChildren().

Specified by:
getParent in class TestObject

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface ModelObject

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

getTitle

public String getTitle()
Gets the human readable title of this result object.

Overrides:
getTitle in class TestResult

getDuration

@Exported(visibility=9)
public float getDuration()
Gets the duration of the test, in seconds

Overrides:
getDuration in class TestResult

getSafeName

public String getSafeName()
Gets the version of getName() that's URL-safe.

Overrides:
getSafeName in class TestObject

getClassName

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


getSimpleName

public String getSimpleName()
Gets the simple (not qualified) class name.


getPackageName

public String getPackageName()
Gets the package name of a test case


getFullName

public String getFullName()

getFailCount

public int getFailCount()
Description copied from class: TestResult
Gets the total number of failed tests.

Overrides:
getFailCount in class TestResult

getSkipCount

public int getSkipCount()
Description copied from class: TestResult
Gets the total number of skipped tests.

Overrides:
getSkipCount in class TestResult

getPassCount

public int getPassCount()
Description copied from class: TestResult
Gets the total number of passed tests.

Overrides:
getPassCount in class TestResult

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

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

getAge

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


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
Since:
1.294

getStderr

@Exported
public String getStderr()
The stderr of this test.

Overrides:
getStderr in class TestResult
Since:
1.294
See Also:
getStdout()

getPreviousResult

public CaseResult getPreviousResult()
Description copied from class: TestResult
Gets the counter part of this TestResult in the previous run.

Overrides:
getPreviousResult in class TestResult
Returns:
null if no such counter part exists.

findCorrespondingResult

public TestResult findCorrespondingResult(String id)
Case results have no children

Specified by:
findCorrespondingResult in class TestObject
Parameters:
id - The path to the original test result
Returns:
null

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

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

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.

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

getSuiteResult

public SuiteResult getSuiteResult()

getOwner

public AbstractBuild<?,?> getOwner()
Specified by:
getOwner in class TestObject

setParentSuiteResult

public void setParentSuiteResult(SuiteResult parent)

freeze

public void freeze(SuiteResult parent)

compareTo

public int compareTo(CaseResult that)
Specified by:
compareTo in interface Comparable<CaseResult>

getStatus

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


Copyright © 2004-2013. All Rights Reserved.