hudson.tasks.junit
Class JUnitResultArchiver

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Recorder
              extended by hudson.tasks.junit.JUnitResultArchiver
All Implemented Interfaces:
ExtensionPoint, MatrixAggregatable, Describable<Publisher>, BuildStep

public class JUnitResultArchiver
extends Recorder
implements MatrixAggregatable

Generates HTML report from JUnit test result XML files.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class JUnitResultArchiver.DescriptorImpl
           
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
JUnitResultArchiver(String testResults)
          Deprecated. since 2009-08-09.
JUnitResultArchiver(String testResults, boolean keepLongStdio, DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers)
           
JUnitResultArchiver(String testResults, DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers)
          Deprecated. 
 
Method Summary
 MatrixAggregator createAggregator(MatrixBuild build, Launcher launcher, BuildListener listener)
          Creates a new instance of the aggregator.
 Collection<Action> getProjectActions(AbstractProject<?,?> project)
          Returns action objects if this BuildStep has actions to contribute to a Project.
 BuildStepMonitor getRequiredMonitorService()
          This class does explicit checkpointing.
 DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> getTestDataPublishers()
           
 String getTestResults()
           
 boolean isKeepLongStdio()
           
protected  TestResult parse(String expandedTestResults, AbstractBuild build, Launcher launcher, BuildListener listener)
          In progress.
protected  TestResult parseResult(org.apache.tools.ant.DirectoryScanner ds, long buildTime)
          Deprecated. since 2009-08-10.
 boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener)
          Runs the step over the given build and reports the progress to the listener.
 
Methods inherited from class hudson.tasks.Recorder
getDescriptor
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, prebuild
 

Constructor Detail

JUnitResultArchiver

@Deprecated
public JUnitResultArchiver(String testResults)
Deprecated. since 2009-08-09.

left for backwards compatibility


JUnitResultArchiver

@Deprecated
public JUnitResultArchiver(String testResults,
                                      DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers)
Deprecated. 


JUnitResultArchiver

@DataBoundConstructor
public JUnitResultArchiver(String testResults,
                                                boolean keepLongStdio,
                                                DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> testDataPublishers)
Method Detail

parse

protected TestResult parse(String expandedTestResults,
                           AbstractBuild build,
                           Launcher launcher,
                           BuildListener listener)
                    throws IOException,
                           InterruptedException
In progress. Working on delegating the actual parsing to the JUnitParser.

Throws:
IOException
InterruptedException

perform

public boolean perform(AbstractBuild build,
                       Launcher launcher,
                       BuildListener listener)
                throws InterruptedException,
                       IOException
Description copied from interface: BuildStep
Runs the step over the given build and reports the progress to the listener.

A plugin can contribute the action object to Actionable.getActions() so that a 'report' becomes a part of the persisted data of Build. This is how JUnit plugin attaches the test report to a build page, for example.

Specified by:
perform in interface BuildStep
Overrides:
perform in class BuildStepCompatibilityLayer
Returns:
true if the build can continue, false if there was an error and the build needs to be aborted.

Using the return value to indicate success/failure should be considered deprecated, and implementations are encouraged to throw AbortException to indicate a failure.

Throws:
InterruptedException - If the build is interrupted by the user (in an attempt to abort the build.) Normally the BuildStep implementations may simply forward the exception it got from its lower-level functions.
IOException - If the implementation wants to abort the processing when an IOException happens, it can simply propagate the exception to the caller. This will cause the build to fail, with the default error message. Implementations are encouraged to catch IOException on its own to provide a better error message, if it can do so, so that users have better understanding on why it failed.

parseResult

protected TestResult parseResult(org.apache.tools.ant.DirectoryScanner ds,
                                 long buildTime)
                          throws IOException
Deprecated. since 2009-08-10.

Not actually used, but left for backward compatibility

Throws:
IOException

getRequiredMonitorService

public BuildStepMonitor getRequiredMonitorService()
This class does explicit checkpointing.

Specified by:
getRequiredMonitorService in interface BuildStep

getTestResults

public String getTestResults()

getTestDataPublishers

public DescribableList<TestDataPublisher,Descriptor<TestDataPublisher>> getTestDataPublishers()

getProjectActions

public Collection<Action> getProjectActions(AbstractProject<?,?> project)
Description copied from interface: BuildStep
Returns action objects if this BuildStep has actions to contribute to a Project.

Project calls this method for every BuildStep that it owns when the rendering is requested.

This action can have optional jobMain.jelly view, which will be aggregated into the main panel of the job top page. The jelly file should have an <h2> tag that shows the section title, followed by some block elements to render the details of the section.

Specified by:
getProjectActions in interface BuildStep
Overrides:
getProjectActions in class BuildStepCompatibilityLayer
Parameters:
project - Project that owns this build step, since BuildStep object doesn't usually have this "parent" pointer.
Returns:
can be empty but never null.

createAggregator

public MatrixAggregator createAggregator(MatrixBuild build,
                                         Launcher launcher,
                                         BuildListener listener)
Description copied from interface: MatrixAggregatable
Creates a new instance of the aggregator.

This method is called during the build of MatrixBuild and the created aggregator will perform the aggregation.

Specified by:
createAggregator in interface MatrixAggregatable
Parameters:
build - The build for which the aggregation shall happen. Never null.
launcher - Can be used to launch processes during the build.
listener - Progress report and errors during the aggregation should be sent to this object. Never null.
Returns:
null if the implementation is not willing to contribute an aggregator.
See Also:
MatrixAggregator.build, MatrixAggregator.listener

isKeepLongStdio

public boolean isKeepLongStdio()
Returns:
the keepLongStdio


Copyright © 2004-2013. All Rights Reserved.