hudson.tasks.test
Class TestObject

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.tasks.junit.TestObject
          extended by hudson.tasks.test.TestObject
All Implemented Interfaces:
ModelObject, SearchableModelObject, SearchItem, Serializable
Direct Known Subclasses:
TestResult

@ExportedBean
public abstract class TestObject
extends TestObject

Base class for all test result objects. For compatibility with code that expects this class to be in hudson.tasks.junit, we've created a pure-abstract class, hudson.tasks.junit.TestObject. That stub class is deprecated; instead, people should use this class.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Constructor Summary
TestObject()
           
 
Method Summary
 org.kohsuke.stapler.HttpResponse doSubmitDescription(String description)
           
abstract  TestResult findCorrespondingResult(String id)
          Find the test result corresponding to the one identified by id> withint this test result.
 Api getApi()
          Exposes this object through the remote API.
 String getDescription()
           
abstract  float getDuration()
          Time took to run this test.
 String getDurationString()
          Returns the string representation of the getDuration(), in a human readable format.
 Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
abstract  int getFailCount()
          Gets the total number of failed tests.
 History getHistory()
           
 String getId()
           
 String getName()
          Gets the name of this object.
abstract  AbstractBuild<?,?> getOwner()
           
abstract  TestObject getParent()
          Reverse pointer of TabulatedResult.getChildren().
abstract  int getPassCount()
          Gets the total number of passed tests.
abstract  TestResult getPreviousResult()
          Gets the counterpart of this TestResult in the previous run.
 String getRelativePathFrom(TestObject it)
          Computes the relative path to get to this test object from it.
abstract  TestResult getResultInBuild(AbstractBuild<?,?> build)
          Gets the counterpart of this TestResult in the specified run.
 String getSafeName()
          Gets the version of getName() that's URL-safe.
 String getSearchUrl()
          Returns the URL of this item relative to the parent SearchItem.
abstract  int getSkipCount()
          Gets the total number of skipped tests.
<T> T
getTestAction(Class<T> klazz)
          Gets a test action of the class passed in.
 List<TestAction> getTestActions()
          Get a list of all TestActions associated with this TestObject.
 TestResult getTestResult()
          Deprecated. This method returns a JUnit specific class. Use getTopLevelTestResult() instead for a more general interface.
 AbstractTestResultAction getTestResultAction()
          Subclasses may override this method if they are associated with a particular subclass of AbstractTestResultAction.
 TestResult getTopLevelTestResult()
          Returns the top level test result data.
 int getTotalCount()
          Gets the total number of tests.
 String getUrl()
          Returns url relative to TestResult
static String safe(String s)
          Replaces URL-unsafe characters.
 void setDescription(String description)
           
protected  String uniquifyName(Collection<? extends TestObject> siblings, String base)
          #2988: uniquifies a getSafeName() amongst children of the parent.
 
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
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 

Constructor Detail

TestObject

public TestObject()
Method Detail

getOwner

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

getParent

public abstract TestObject getParent()
Reverse pointer of TabulatedResult.getChildren().

Specified by:
getParent in class TestObject

getId

public final String getId()
Specified by:
getId in class TestObject

getUrl

public String getUrl()
Returns url relative to TestResult

Specified by:
getUrl in class TestObject

getTestResult

public TestResult getTestResult()
Deprecated. This method returns a JUnit specific class. Use getTopLevelTestResult() instead for a more general interface.

Returns the top level test result data.

Specified by:
getTestResult in class TestObject
Returns:

getTopLevelTestResult

public TestResult getTopLevelTestResult()
Returns the top level test result data.

Returns:

getRelativePathFrom

public String getRelativePathFrom(TestObject it)
Computes the relative path to get to this test object from it. If it does not appear in the parent chain for this object, a relative path from the server root will be returned.

Returns:
A relative path to this object, potentially from the top of the Hudson object model

getTestResultAction

public AbstractTestResultAction getTestResultAction()
Subclasses may override this method if they are associated with a particular subclass of AbstractTestResultAction.

Specified by:
getTestResultAction in class TestObject
Returns:
the test result action that connects this test result to a particular build

getTestActions

public List<TestAction> getTestActions()
Get a list of all TestActions associated with this TestObject.

Specified by:
getTestActions in class TestObject
Returns:

getTestAction

public <T> T getTestAction(Class<T> klazz)
Gets a test action of the class passed in.

Specified by:
getTestAction in class TestObject
Type Parameters:
T - an instance of the class passed in
Parameters:
klazz -
Returns:

getPreviousResult

public abstract TestResult getPreviousResult()
Gets the counterpart of this TestResult in the previous run.

Specified by:
getPreviousResult in class TestObject
Returns:
null if no such counter part exists.

getResultInBuild

public abstract TestResult getResultInBuild(AbstractBuild<?,?> build)
Gets the counterpart of this TestResult in the specified run.

Specified by:
getResultInBuild in class TestObject
Returns:
null if no such counter part exists.

findCorrespondingResult

public abstract TestResult findCorrespondingResult(String id)
Find the test result corresponding to the one identified by id> withint this test result.

Parameters:
id - The path to the original test result
Returns:
A corresponding test result, or null if there is no corresponding result.

getDuration

public abstract float getDuration()
Time took to run this test. In seconds.

Specified by:
getDuration in class TestObject

getDurationString

public String getDurationString()
Returns the string representation of the getDuration(), in a human readable format.

Specified by:
getDurationString in class TestObject

getDescription

public String getDescription()
Specified by:
getDescription in class TestObject

setDescription

public void setDescription(String description)
Specified by:
setDescription in class TestObject

getApi

public Api getApi()
Exposes this object through the remote API.

Specified by:
getApi in class TestObject

getName

public String getName()
Gets the name of this object.

Specified by:
getName in class TestObject

getSafeName

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

Specified by:
getSafeName in class TestObject

getSearchUrl

public String getSearchUrl()
Description copied from interface: SearchItem
Returns the URL of this item relative to the parent SearchItem.

Specified by:
getSearchUrl in interface SearchItem
Specified by:
getSearchUrl in class TestObject
Returns:
URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Hudson.)

uniquifyName

protected final String uniquifyName(Collection<? extends TestObject> siblings,
                                    String base)
#2988: uniquifies a getSafeName() amongst children of the parent.


safe

public static String safe(String s)
Replaces URL-unsafe characters.


getPassCount

public abstract int getPassCount()
Gets the total number of passed tests.

Specified by:
getPassCount in class TestObject

getFailCount

public abstract int getFailCount()
Gets the total number of failed tests.

Specified by:
getFailCount in class TestObject

getSkipCount

public abstract int getSkipCount()
Gets the total number of skipped tests.

Specified by:
getSkipCount in class TestObject

getTotalCount

public int getTotalCount()
Gets the total number of tests.

Specified by:
getTotalCount in class TestObject

getHistory

public History getHistory()
Specified by:
getHistory in class TestObject

getDynamic

public Object getDynamic(String token,
                         org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)

doSubmitDescription

public org.kohsuke.stapler.HttpResponse doSubmitDescription(@QueryParameter
                                                            String description)
                                                     throws IOException,
                                                            javax.servlet.ServletException
Throws:
IOException
javax.servlet.ServletException


Copyright © 2004-2013. All Rights Reserved.