Package hudson.tasks.test
Class TestResultParser
java.lang.Object
hudson.tasks.test.TestResultParser
- Direct Known Subclasses:
DefaultTestResultParserImpl
,JUnitParser
Parses test result files and builds in-memory representation of it as
TestResult
.
Originally this was treated as an ExtensionPoint
,
but no supported code path actually uses this API directly. See all()
.
Parsers are stateless, and the parseResult(java.lang.String, hudson.model.Run<?, ?>, hudson.FilePath, hudson.Launcher, hudson.model.TaskListener)
method
can be concurrently invoked by multiple threads for different builds.
- Since:
- 1.343
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExtensionList<TestResultParser>
all()
Deprecated.Unused.Deprecated.Normally unused.Deprecated.Normally unused.parse
(String testResultLocations, AbstractBuild build, Launcher launcher, TaskListener listener) Deprecated.parseResult
(String testResultLocations, Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) Deprecated.parseResult
(String testResultLocations, Run<?, ?> run, PipelineTestDetails pipelineTestDetails, FilePath workspace, Launcher launcher, TaskListener listener) Parses the specified set of files and builds aTestResult
object that represents them.
-
Constructor Details
-
TestResultParser
public TestResultParser()
-
-
Method Details
-
getDisplayName
Deprecated.Normally unused.Returns a human readable name of the parser, like "JUnit Parser".- Returns:
- a human readable name of the parser, like "JUnit Parser".
-
getTestResultLocationMessage
Deprecated.Normally unused.This text is used in the UI prompt for the GLOB that specifies files to be parsed by this parser. For example, "JUnit XML reports:"- Returns:
- the text is used in the UI prompt for the GLOB that specifies files to be parsed by this parser.
-
all
Deprecated.Unused. In fact only thelabeled-test-groups-publisher
plugin seems to actually enumerate parsers this way (though not using this method), a use case superseded byPipelineTestDetails
.All registeredTestResultParser
s.- Returns:
- all registered
TestResultParser
s.
-
parseResult
@Deprecated public TestResult parseResult(String testResultLocations, Run<?, ?> run, @NonNull FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionDeprecated.- Throws:
InterruptedException
IOException
-
parseResult
public TestResult parseResult(String testResultLocations, Run<?, ?> run, PipelineTestDetails pipelineTestDetails, @NonNull FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionParses the specified set of files and builds aTestResult
object that represents them.The implementation is encouraged to do the following:
- If the build is successful but GLOB didn't match anything, report that as an error. This is to detect the error in GLOB. But don't do this if the build has already failed (for example, think of a failure in SCM checkout.)
- Examine time stamp of test report files and if those are younger than the build, ignore them. This is to ignore test reports created by earlier executions. Take the possible timestamp difference in the controller/agent into account.
- Parameters:
testResultLocations
- GLOB pattern relative to theworkspace
that specifies the locations of the test result files. Never null.run
- Build for which these tests are parsed. Never null.pipelineTestDetails
- APipelineTestDetails
instance containing Pipeline-related additional arguments.workspace
- the workspace in which tests can be foundlauncher
- Can be used to fork processes on the machine where the build is running. Never null.listener
- Use this to report progress and other problems. Never null.- Returns:
- a
TestResult
object representing the provided files and builds. - Throws:
InterruptedException
- If the user cancels the build, it will be received as a thread interruption. Do not catch it, and instead just forward that through the call stack.IOException
- If you don't care about handling exceptions gracefully, you can just throw IOException and let the default exception handling in Hudson takes care of it.AbortException
- If you encounter an error that you handled gracefully, throw this exception and Hudson will not show a stack trace.- Since:
- 1.22
-
parse
@Deprecated public TestResult parse(String testResultLocations, AbstractBuild build, Launcher launcher, TaskListener listener) throws InterruptedException, IOException Deprecated.- Throws:
InterruptedException
IOException
-