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 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 Details

    • TestResultParser

      public TestResultParser()
  • Method Details

    • 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.
      Unused. In fact only the labeled-test-groups-publisher plugin seems to actually enumerate parsers this way (though not using this method), a use case superseded by PipelineTestDetails.
      All registered TestResultParsers.
      Returns:
      all registered TestResultParsers.
    • 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 a TestResult 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 the workspace that specifies the locations of the test result files. Never null.
      run - Build for which these tests are parsed. Never null.
      pipelineTestDetails - A PipelineTestDetails instance containing Pipeline-related additional arguments.
      workspace - the workspace in which tests can be found
      launcher - 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