Package hudson.tasks.junit
Class TestResultAction
- java.lang.Object
-
- hudson.tasks.test.AbstractTestResultAction<TestResultAction>
-
- hudson.tasks.junit.TestResultAction
-
- All Implemented Interfaces:
Action
,HealthReportingAction
,ModelObject
,RunAction2
,SimpleBuildStep.LastBuildAction
,org.kohsuke.stapler.StaplerProxy
public class TestResultAction extends AbstractTestResultAction<TestResultAction> implements org.kohsuke.stapler.StaplerProxy, SimpleBuildStep.LastBuildAction
Action
that displays the JUnit test result.The actual test reports are isolated by
WeakReference
so that it doesn't eat up too much memory.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestResultAction.Data
ResolvesTestAction
s for the givenTestObject
.-
Nested classes/interfaces inherited from class hudson.tasks.test.AbstractTestResultAction
AbstractTestResultAction.Summarizer
-
-
Field Summary
-
Fields inherited from class hudson.tasks.test.AbstractTestResultAction
owner, run
-
-
Constructor Summary
Constructors Constructor Description TestResultAction(AbstractBuild owner, TestResult result, BuildListener listener)
Deprecated.TestResultAction(Run owner, TestResult result, TaskListener listener)
TestResultAction(TestResult result, BuildListener listener)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addData(TestResultAction.Data data)
Adds aTestResultAction.Data
to the test data associated with this action.List<TestAction>
getActions(TestObject object)
int
getFailCount()
Gets the number of failed tests.List<CaseResult>
getFailedTests()
A shortcut for summary.jellydouble
getHealthScaleFactor()
Returns how much to scale the test related health by.List<CaseResult>
getPassedTests()
A shortcut for scriptingCollection<? extends Action>
getProjectActions()
TestResult
getResult()
Returns the object that represents the actual test result.int
getSkipCount()
Gets the number of skipped tests.List<CaseResult>
getSkippedTests()
A shortcut for scriptingObject
getTarget()
int
getTotalCount()
Gets the total number of tests.void
mergeResult(TestResult additionalResult, TaskListener listener)
Merges an additional test result into this one.Object
readResolve()
void
setData(List<TestResultAction.Data> testData)
Replaces to collection of test data associated with this action.void
setHealthScaleFactor(double healthScaleFactor)
void
setResult(TestResult result, BuildListener listener)
Deprecated.void
setResult(TestResult result, TaskListener listener)
Overwrites theTestResult
by a new data set.-
Methods inherited from class hudson.tasks.test.AbstractTestResultAction
doGraph, doGraphMap, findCorrespondingResult, findPreviousCorresponding, getApi, getBuildHealth, getDescription, getDisplayName, getFailureDiffString, getIconFileName, getPreviousResult, getPreviousResult, getTestResultPath, getUrlName, onAttached, onLoad, setDescription
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.model.Action
getDisplayName, getIconFileName, getUrlName
-
-
-
-
Constructor Detail
-
TestResultAction
@Deprecated public TestResultAction(AbstractBuild owner, TestResult result, BuildListener listener)
Deprecated.
-
TestResultAction
public TestResultAction(Run owner, TestResult result, TaskListener listener)
- Since:
- 1.2-beta-1
-
TestResultAction
@Deprecated public TestResultAction(TestResult result, BuildListener listener)
Deprecated.
-
-
Method Detail
-
getProjectActions
public Collection<? extends Action> getProjectActions()
- Specified by:
getProjectActions
in interfaceSimpleBuildStep.LastBuildAction
-
setResult
public void setResult(TestResult result, TaskListener listener)
Overwrites theTestResult
by a new data set.- Since:
- 1.2-beta-1
-
setResult
@Deprecated public void setResult(TestResult result, BuildListener listener)
Deprecated.
-
getResult
public TestResult getResult()
Description copied from class:AbstractTestResultAction
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
.- Specified by:
getResult
in classAbstractTestResultAction<TestResultAction>
-
getFailCount
public int getFailCount()
Description copied from class:AbstractTestResultAction
Gets the number of failed tests.- Specified by:
getFailCount
in classAbstractTestResultAction<TestResultAction>
-
getSkipCount
public int getSkipCount()
Description copied from class:AbstractTestResultAction
Gets the number of skipped tests.- Overrides:
getSkipCount
in classAbstractTestResultAction<TestResultAction>
-
getTotalCount
public int getTotalCount()
Description copied from class:AbstractTestResultAction
Gets the total number of tests.- Specified by:
getTotalCount
in classAbstractTestResultAction<TestResultAction>
-
getHealthScaleFactor
public double getHealthScaleFactor()
Description copied from class:AbstractTestResultAction
Returns how much to scale the test related health by.- Overrides:
getHealthScaleFactor
in classAbstractTestResultAction<TestResultAction>
- 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.
-
setHealthScaleFactor
public void setHealthScaleFactor(double healthScaleFactor)
-
getFailedTests
public List<CaseResult> getFailedTests()
Description copied from class:AbstractTestResultAction
A shortcut for summary.jelly- Overrides:
getFailedTests
in classAbstractTestResultAction<TestResultAction>
- Returns:
- List of failed tests from associated test result.
-
getPassedTests
public List<CaseResult> getPassedTests()
Description copied from class:AbstractTestResultAction
A shortcut for scripting- Overrides:
getPassedTests
in classAbstractTestResultAction<TestResultAction>
- Returns:
- List of passed tests from associated test result.
-
getSkippedTests
public List<CaseResult> getSkippedTests()
Description copied from class:AbstractTestResultAction
A shortcut for scripting- Overrides:
getSkippedTests
in classAbstractTestResultAction<TestResultAction>
- Returns:
- List of skipped tests from associated test result.
-
getTarget
public Object getTarget()
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
getActions
public List<TestAction> getActions(TestObject object)
-
setData
public void setData(List<TestResultAction.Data> testData)
Replaces to collection of test data associated with this action.This method will not automatically persist the data at the time of addition.
-
addData
public void addData(TestResultAction.Data data)
Adds aTestResultAction.Data
to the test data associated with this action.This method will not automatically persist the data at the time of addition.
- Since:
- 1.21
-
mergeResult
public void mergeResult(TestResult additionalResult, TaskListener listener)
Merges an additional test result into this one.
-
readResolve
public Object readResolve()
- Overrides:
readResolve
in classAbstractTestResultAction<TestResultAction>
-
-