Package hudson.tasks.test
Class AbstractTestResultAction<T extends AbstractTestResultAction>
- java.lang.Object
-
- hudson.tasks.test.AbstractTestResultAction<T>
-
- All Implemented Interfaces:
Action
,HealthReportingAction
,ModelObject
,RunAction2
- Direct Known Subclasses:
AggregatedTestResultAction
,AggregatedTestResultPublisher.TestResultAction
,TestResultAction
@ExportedBean public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> extends Object implements HealthReportingAction, RunAction2
Common base class for recording test result.Project
andBuild
recognizesAction
s that derive from this, and displays it nicely (regardless of the underlying implementation.)- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTestResultAction.Summarizer
-
Field Summary
Fields Modifier and Type Field Description AbstractBuild<?,?>
owner
Deprecated.Run<?,?>
run
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTestResultAction()
protected
AbstractTestResultAction(AbstractBuild owner)
Deprecated.protected
AbstractTestResultAction(Run owner)
Deprecated.Use the default constructor and just callRun.addAction(hudson.model.Action)
to associate the build with the action.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
doGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Deprecated.Replaced by echarts in TODOvoid
doGraphMap(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Generates a clickable map HTML fordoGraph(StaplerRequest, StaplerResponse)
.TestResult
findCorrespondingResult(String id)
TestResult
findPreviousCorresponding(TestResult test)
Api
getApi()
Exposes this object to the remote API.HealthReport
getBuildHealth()
protected String
getDescription(TestObject object)
TestObject
s do not have their own persistence mechanism, so updatable data ofTestObject
s need to be persisted by the owningAbstractTestResultAction
, and this method andsetDescription(TestObject, String)
provides that logic.String
getDisplayName()
abstract int
getFailCount()
Gets the number of failed tests.List<? extends TestResult>
getFailedTests()
A shortcut for summary.jellyString
getFailureDiffString()
Gets the diff string of failures.double
getHealthScaleFactor()
Returns how much to scale the test related health by.String
getIconFileName()
List<? extends TestResult>
getPassedTests()
A shortcut for scriptingT
getPreviousResult()
Gets the test result of the previous build, if it's recorded, or null.<U extends AbstractTestResultAction>
UgetPreviousResult(Class<U> type, boolean eager)
abstract Object
getResult()
Returns the object that represents the actual test result.int
getSkipCount()
Gets the number of skipped tests.List<? extends TestResult>
getSkippedTests()
A shortcut for scriptingString
getTestResultPath(TestResult it)
Returns a full path down to a test resultabstract int
getTotalCount()
Gets the total number of tests.String
getUrlName()
void
onAttached(Run<?,?> r)
void
onLoad(Run<?,?> r)
Object
readResolve()
protected void
setDescription(TestObject object, String description)
-
-
-
Field Detail
-
run
public transient Run<?,?> run
- Since:
- 1.2-beta-1
-
owner
@Deprecated public transient AbstractBuild<?,?> owner
Deprecated.
-
-
Constructor Detail
-
AbstractTestResultAction
protected AbstractTestResultAction()
- Since:
- 1.545
-
AbstractTestResultAction
@Deprecated protected AbstractTestResultAction(Run owner)
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 protected AbstractTestResultAction(AbstractBuild owner)
Deprecated.
-
-
Method Detail
-
onAttached
public void onAttached(Run<?,?> r)
- Specified by:
onAttached
in interfaceRunAction2
-
onLoad
public void onLoad(Run<?,?> r)
- Specified by:
onLoad
in 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
public final String getFailureDiffString()
Gets the diff string of failures.
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
@Exported(visibility=2) public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getBuildHealth
public HealthReport getBuildHealth()
- Specified by:
getBuildHealth
in interfaceHealthReportingAction
-
getHealthScaleFactor
public double getHealthScaleFactor()
Returns how much to scale the test related health by.- Returns:
- a factor of
1.0
to have the test health be the percentage of tests passing so 20% of tests failing will report as 80% health. A factor of2.0
will mean that 20% of tests failing will report as 60% health. A factor of2.5
will mean that 20% of test failing will report as 50% health. A factor of4.0
will mean that 20% of tests failing will report as 20% health. A factor of5.0
will mean that 20% (or more) of tests failing will report as 0% health. A factor of0.0
will disable test health reporting.
-
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.
-
getPreviousResult
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public <U extends AbstractTestResultAction> U getPreviousResult(Class<U> type, boolean eager)
-
findPreviousCorresponding
public TestResult findPreviousCorresponding(TestResult test)
-
findCorrespondingResult
public TestResult findCorrespondingResult(String id)
-
getFailedTests
public List<? extends TestResult> getFailedTests()
A shortcut for summary.jelly- Returns:
- List of failed tests from associated test result.
-
getPassedTests
@NonNull public List<? extends TestResult> getPassedTests()
A shortcut for scripting- Returns:
- List of passed tests from associated test result.
- Since:
- 1.10
-
getSkippedTests
@NonNull public List<? extends TestResult> 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
public String getTestResultPath(TestResult it)
Returns a full path down to a test result
-
getDescription
protected String getDescription(TestObject object)
TestObject
s do not have their own persistence mechanism, so updatable data ofTestObject
s 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:
TestObject.getDescription()
-
setDescription
protected void setDescription(TestObject object, String description)
-
readResolve
public Object readResolve()
-
-