Package hudson.tasks.test
Class TestResultParser
- java.lang.Object
-
- hudson.tasks.test.TestResultParser
-
- Direct Known Subclasses:
DefaultTestResultParserImpl
,JUnitParser
public abstract class TestResultParser extends Object
Parses test result files and builds in-memory representation of it asTestResult
.Originally this was treated as an
ExtensionPoint
, but no supported code path actually uses this API directly. Seeall()
.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
Constructors Constructor Description TestResultParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ExtensionList<TestResultParser>
all()
Deprecated.Unused.String
getDisplayName()
Deprecated.Normally unused.String
getTestResultLocationMessage()
Deprecated.Normally unused.TestResult
parse(String testResultLocations, AbstractBuild build, Launcher launcher, TaskListener listener)
Deprecated.TestResult
parseResult(String testResultLocations, Run<?,?> run, FilePath workspace, Launcher launcher, TaskListener listener)
Deprecated.TestResult
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.
-
-
-
Method Detail
-
getDisplayName
@Deprecated public String 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 public String 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 public static ExtensionList<TestResultParser> 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, IOException
Deprecated.- Throws:
InterruptedException
IOException
-
parseResult
public TestResult parseResult(String testResultLocations, Run<?,?> run, PipelineTestDetails pipelineTestDetails, @NonNull FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException
Parses 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
-
-