Package hudson.tasks.test
Class AbstractTestResultAction<T extends AbstractTestResultAction>
java.lang.Object
jenkins.model.Tab
hudson.tasks.test.AbstractTestResultAction<T>
- All Implemented Interfaces:
Action,HealthReportingAction,ModelObject,Badgeable,RunAction2
- Direct Known Subclasses:
AggregatedTestResultAction,AggregatedTestResultPublisher.TestResultAction,TestResultAction
@ExportedBean
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction>
extends Tab
implements HealthReportingAction, RunAction2
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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedDeprecated.protectedAbstractTestResultAction(Run owner) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.Replaced by echarts in TODOvoiddoGraphMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Generates a clickable map HTML fordoGraph(StaplerRequest, StaplerResponse).getApi()Exposes this object to the remote API.getBadge()protected StringgetDescription(TestObject object) TestObjects do not have their own persistence mechanism, so updatable data ofTestObjects need to be persisted by the owningAbstractTestResultAction, and this method andsetDescription(TestObject, String)provides that logic.abstract intGets the number of failed tests.List<? extends TestResult>A shortcut for summary.jellyfinal StringGets the diff string of failures.doubleReturns how much to scale the test related health by.List<? extends TestResult>A shortcut for scriptingGets the test result of the previous build, if it's recorded, or null.<U extends AbstractTestResultAction>
UgetPreviousResult(Class<U> type, boolean eager) abstract ObjectReturns the object that represents the actual test result.intGets the number of skipped tests.List<? extends TestResult>A shortcut for scriptingReturns a full path down to a test resultabstract intGets the total number of tests.voidonAttached(Run<?, ?> r) voidprotected voidsetDescription(TestObject object, String description)
-
Field Details
-
run
- Since:
- 1.2-beta-1
-
owner
Deprecated.
-
-
Constructor Details
-
AbstractTestResultAction
protected AbstractTestResultAction()- Since:
- 1.545
-
AbstractTestResultAction
Deprecated.Use the default constructor and just callRun.addAction(hudson.model.Action)to associate the build with the action.- Since:
- 1.2-beta-1
-
AbstractTestResultAction
Deprecated.
-
-
Method Details
-
onAttached
- Specified by:
onAttachedin interfaceRunAction2
-
onLoad
- Specified by:
onLoadin interfaceRunAction2
-
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
Gets the diff string of failures. -
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
- Specified by:
getUrlNamein interfaceAction
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction
-
getBadge
-
getBuildHealth
- Specified by:
getBuildHealthin interfaceHealthReportingAction
-
getHealthScaleFactor
public double getHealthScaleFactor()Returns how much to scale the test related health by.- Returns:
- a factor of
1.0to have the test health be the percentage of tests passing so 20% of tests failing will report as 80% health. A factor of2.0will mean that 20% of tests failing will report as 60% health. A factor of2.5will mean that 20% of test failing will report as 50% health. A factor of4.0will mean that 20% of tests failing will report as 20% health. A factor of5.0will mean that 20% (or more) of tests failing will report as 0% health. A factor of0.0will disable test health reporting.
-
getApi
Exposes this object to the remote API. -
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,AbstractTestResultActionin between.If such a concept doesn't make sense for a particular subtype, return
this. -
getPreviousResult
Gets the test result of the previous build, if it's recorded, or null. -
getPreviousResult
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager) -
findPreviousCorresponding
-
findCorrespondingResult
-
getFailedTests
A shortcut for summary.jelly- Returns:
- List of failed tests from associated test result.
-
getPassedTests
A shortcut for scripting- Returns:
- List of passed tests from associated test result.
- Since:
- 1.10
-
getSkippedTests
A shortcut for scripting- Returns:
- List of skipped tests from associated test result.
- Since:
- 1.10
-
doGraph
@Deprecated public void doGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException Deprecated.Replaced by echarts in TODOGenerates 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 fordoGraph(StaplerRequest, StaplerResponse).- Throws:
IOException
-
getTestResultPath
Returns a full path down to a test result -
getDescription
TestObjects do not have their own persistence mechanism, so updatable data ofTestObjects need to be persisted by the owningAbstractTestResultAction, and this method andsetDescription(TestObject, String)provides that logic.The default implementation stores information in the 'this' object.
- See Also:
-
setDescription
-
readResolve
-
Run.addAction(hudson.model.Action)to associate the build with the action.