hudson.tasks.test
Class AbstractTestResultAction<T extends AbstractTestResultAction>

java.lang.Object
  extended by hudson.tasks.test.AbstractTestResultAction<T>
All Implemented Interfaces:
Action, HealthReportingAction, ModelObject
Direct Known Subclasses:
AggregatedTestResultAction, AggregatedTestResultPublisher.TestResultAction, TestResultAction

@ExportedBean
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction>
extends Object
implements HealthReportingAction

Common base class for recording test result.

Project and Build recognizes Actions that derive from this, and displays it nicely (regardless of the underlying implementation.)

Author:
Kohsuke Kawaguchi

Field Summary
 AbstractBuild<?,?> owner
           
 
Constructor Summary
protected AbstractTestResultAction(AbstractBuild owner)
           
 
Method Summary
 void doGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Generates a PNG image for the test result trend.
 void doGraphMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Generates a clickable map HTML for doGraph(StaplerRequest, StaplerResponse).
 TestResult findCorrespondingResult(String id)
           
 TestResult findPreviousCorresponding(TestResult test)
           
 Api getApi()
          Exposes this object to the remote API.
 HealthReport getBuildHealth()
          Get this Action's HealthReport.
protected  String getDescription(TestObject object)
          TestObjects do not have their own persistence mechanism, so updatable data of TestObjects need to be persisted by the owning AbstractTestResultAction, and this method and setDescription(TestObject, String) provides that logic.
 String getDisplayName()
          Gets the string to be displayed.
abstract  int getFailCount()
          Gets the number of failed tests.
 List<CaseResult> getFailedTests()
          A shortcut for summary.jelly
 String getFailureDiffString()
          Gets the diff string of failures.
 String getIconFileName()
          Gets the file name of the icon.
 T getPreviousResult()
          Gets the test result of the previous build, if it's recorded, or null.
abstract  Object getResult()
          Returns the object that represents the actual test result.
 int getSkipCount()
          Gets the number of skipped tests.
 String getTestResultPath(TestResult it)
          Returns a full path down to a test result
abstract  int getTotalCount()
          Gets the total number of tests.
 String getUrlName()
          Gets the URL path name.
 Object readResolve()
           
protected  void setDescription(TestObject object, String description)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

public final AbstractBuild<?,?> owner
Constructor Detail

AbstractTestResultAction

protected AbstractTestResultAction(AbstractBuild owner)
Method Detail

getFailCount

@Exported(visibility=2)
public abstract int getFailCount()
Gets the number of failed tests.


getSkipCount

@Exported(visibility=2)
public int getSkipCount()
Gets the number of skipped tests.


getTotalCount

@Exported(visibility=2)
public abstract int getTotalCount()
Gets the total number of tests.


getFailureDiffString

public final String getFailureDiffString()
Gets the diff string of failures.


getDisplayName

public String getDisplayName()
Description copied from interface: Action
Gets the string to be displayed. The convention is to capitalize the first letter of each word, such as "Test Result".

Specified by:
getDisplayName in interface Action
Specified by:
getDisplayName in interface ModelObject

getUrlName

@Exported(visibility=2)
public String getUrlName()
Description copied from interface: Action
Gets the URL path name.

tions For example, if this method returns "xyz", and if the parent object (that this action is associated with) is bound to /foo/bar/zot, then this action object will be exposed to /foo/bar/zot/xyz.

This method should return a string that's unique among other Actions.

The returned string can be an absolute URL, like "http://www.sun.com/", which is useful for directly connecting to external systems.

If the returned string starts with '/', like '/foo', then it's assumed to be relative to the context path of the Jenkins webapp.

Specified by:
getUrlName in interface Action
Returns:
null if this action object doesn't need to be bound to web (when you do that, be sure to also return null from Action.getIconFileName().
See Also:
Functions.getActionUrl(String, Action)

getIconFileName

public String getIconFileName()
Description copied from interface: Action
Gets the file name of the icon.

Specified by:
getIconFileName in interface Action
Returns:
If just a file name (like "abc.gif") is returned, it will be interpreted as a file name inside /images/24x24. This is useful for using one of the stock images.

If an absolute file name that starts from '/' is returned (like "/plugin/foo/abc.gif'), then it will be interpreted as a path from the context root of Jenkins. This is useful to pick up image files from a plugin.

Finally, return null to hide it from the task list. This is normally not very useful, but this can be used for actions that only contribute floatBox.jelly and no task list item. The other case where this is useful is to avoid showing links that require a privilege when the user is anonymous.

See Also:
Functions.isAnonymous(), Functions.getIconFilePath(Action)

getBuildHealth

public HealthReport getBuildHealth()
Description copied from interface: HealthReportingAction
Get this Action's HealthReport.

Specified by:
getBuildHealth in interface HealthReportingAction
Returns:
The health report for this instance of the Action or null if the Action does not want to contribute a HealthReport.

getApi

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


getResult

public abstract Object getResult()
Returns the object that represents the actual test result. This method is used by the remote API so that the XML/JSON that we are sending won't contain unnecessary indirection (that is, AbstractTestResultAction in between.

If such a concept doesn't make sense for a particular subtype, return this.


getPreviousResult

public T getPreviousResult()
Gets the test result of the previous build, if it's recorded, or null.


findPreviousCorresponding

public TestResult findPreviousCorresponding(TestResult test)

findCorrespondingResult

public TestResult findCorrespondingResult(String id)

getFailedTests

public List<CaseResult> getFailedTests()
A shortcut for summary.jelly

Returns:
List of failed tests from associated test result.

doGraph

public void doGraph(org.kohsuke.stapler.StaplerRequest req,
                    org.kohsuke.stapler.StaplerResponse rsp)
             throws IOException
Generates a PNG image for the test result trend.

Throws:
IOException

doGraphMap

public void doGraphMap(org.kohsuke.stapler.StaplerRequest req,
                       org.kohsuke.stapler.StaplerResponse rsp)
                throws IOException
Generates a clickable map HTML for doGraph(StaplerRequest, StaplerResponse).

Throws:
IOException

getTestResultPath

public String getTestResultPath(TestResult it)
Returns a full path down to a test result


getDescription

protected String getDescription(TestObject object)
TestObjects do not have their own persistence mechanism, so updatable data of TestObjects need to be persisted by the owning AbstractTestResultAction, and this method and setDescription(TestObject, String) provides that logic.

The default implementation stores information in the 'this' object.

See Also:
TestObject.getDescription()

setDescription

protected void setDescription(TestObject object,
                              String description)

readResolve

public Object readResolve()


Copyright © 2004-2013. All Rights Reserved.