net.sf.ant4eclipse.ant.task.launch
Class LaunchJUnitTask

java.lang.Object
  extended by Task
      extended by net.sf.ant4eclipse.ant.task.launch.AbstractLaunchTask
          extended by net.sf.ant4eclipse.ant.task.launch.LaunchJUnitTask

public class LaunchJUnitTask
extends AbstractLaunchTask

LaunchTask -- Specialized Launchtask for launching junit tests.


Constructor Summary
LaunchJUnitTask()
           
 
Method Summary
 void addFormatter(FormatterElement fe)
          Add a new formatter to all tests of this task.
 void execute()
          
 void setErrorProperty(java.lang.String propertyName)
          Property to set to "true" if there is a error in a test.
 void setFailureProperty(java.lang.String propertyName)
          Property to set to "true" if there is a failure in a test.
 void setFiltertrace(boolean value)
          If true, smartly filter the stack frames of JUnit errors and failures before reporting them.
 void setForkMode(ForkMode mode)
          Set the fork behavior.
 void setHaltonerror(boolean value)
          If true, stop the build process when there is an error in a test.
 void setHaltonfailure(boolean value)
          If true, stop the build process if a test fails (errors are considered failures as well).
 void setPrintsummary(SummaryAttribute value)
          If true, print one-line statistics for each test, or "withOutAndErr" to also show standard output and error.
 void setReloading(boolean value)
          If true, force ant to re-classload all classes for each JUnit TestCase
 void setShowOutput(boolean showOutput)
          If true, send any output generated by tests to Ant's logging system as well as to the formatters.
 void setTempdir(java.io.File tmpDir)
          Where Ant should place temporary files.
 void setTimeout(java.lang.Integer value)
          Set the timeout value (in milliseconds).
protected  java.lang.Class[] validTypes()
          Returns a list of classes which are valid launch configuration types.
 
Methods inherited from class net.sf.ant4eclipse.ant.task.launch.AbstractLaunchTask
getLaunchFile, getLaunchProject, getWorkspace, isLaunchConfigurationSet, isWorkspaceSet, readLaunchConfiguration, readLaunchProject, requireWorkspaceSet, setInitialiseWorkspace, setLaunchFile, setWorkspace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LaunchJUnitTask

public LaunchJUnitTask()
Method Detail

execute

public void execute()
             throws BuildException

Throws:
BuildException

setReloading

public void setReloading(boolean value)
If true, force ant to re-classload all classes for each JUnit TestCase

Parameters:
value - force class reloading for each test case

setFiltertrace

public void setFiltertrace(boolean value)
If true, smartly filter the stack frames of JUnit errors and failures before reporting them.

This property is applied on all BatchTest (batchtest) and JUnitTest (test) however it can possibly be overridden by their own properties.

Parameters:
value - false if it should not filter, otherwise true
Since:
Ant 1.5

setHaltonerror

public void setHaltonerror(boolean value)
If true, stop the build process when there is an error in a test. This property is applied on all BatchTest (batchtest) and JUnitTest (test) however it can possibly be overridden by their own properties.

Parameters:
value - true if it should halt, otherwise false
Since:
Ant 1.2

setErrorProperty

public void setErrorProperty(java.lang.String propertyName)
Property to set to "true" if there is a error in a test.

This property is applied on all BatchTest (batchtest) and JUnitTest (test), however, it can possibly be overriden by their own properties.

Parameters:
propertyName - the name of the property to set in the event of an error.
Since:
Ant 1.4

setHaltonfailure

public void setHaltonfailure(boolean value)
If true, stop the build process if a test fails (errors are considered failures as well). This property is applied on all BatchTest (batchtest) and JUnitTest (test) however it can possibly be overridden by their own properties.

Parameters:
value - true if it should halt, otherwise false
Since:
Ant 1.2

setFailureProperty

public void setFailureProperty(java.lang.String propertyName)
Property to set to "true" if there is a failure in a test.

This property is applied on all BatchTest (batchtest) and JUnitTest (test), however, it can possibly be overriden by their own properties.

Parameters:
propertyName - the name of the property to set in the event of an failure.
Since:
Ant 1.4

setForkMode

public void setForkMode(ForkMode mode)
Set the fork behavior. In opposite to ant's default JUnit-Task the launch task always forks junit test.

Possible values are "once", "perTest" and "perBatch". If set to "once", only a single Java VM will be forked for all tests, with "perTest" (the default) each test will run in a fresh Java VM and "perBatch" will run all tests from the same <batchtest> in the same Java VM.

Only tests with the same configuration of haltonerror, haltonfailure, errorproperty, failureproperty and filtertrace can share a forked Java VM, so even if you set the value to "once", Ant may need to fork mutliple VMs.

Since:
Ant 1.6.2

setPrintsummary

public void setPrintsummary(SummaryAttribute value)
If true, print one-line statistics for each test, or "withOutAndErr" to also show standard output and error. Can take the values on, off, and withOutAndErr.

Parameters:
value - true to print a summary, withOutAndErr to include the test's output as well, false otherwise.
Since:
Ant 1.2
See Also:
SummaryJUnitResultFormatter

setTimeout

public void setTimeout(java.lang.Integer value)
Set the timeout value (in milliseconds).

If the test is running for more than this value, the test will be canceled. (works only when in 'fork' mode).

Parameters:
value - the maximum time (in milliseconds) allowed before declaring the test as 'timed-out'
Since:
Ant 1.2
See Also:
setForkMode(ForkMode)

addFormatter

public void addFormatter(FormatterElement fe)
Add a new formatter to all tests of this task.

Parameters:
fe - formatter element
Since:
Ant 1.2

setShowOutput

public void setShowOutput(boolean showOutput)
If true, send any output generated by tests to Ant's logging system as well as to the formatters. By default only the formatters receive the output.

Output will always be passed to the formatters and not by shown by default. This option should for example be set for tests that are interactive and prompt the user to do something.

Parameters:
showOutput - if true, send output to Ant's logging system too
Since:
Ant 1.5

setTempdir

public void setTempdir(java.io.File tmpDir)
Where Ant should place temporary files.

Parameters:
tmpDir - location where temporary files should go to
Since:
Ant 1.6

validTypes

protected java.lang.Class[] validTypes()
Returns a list of classes which are valid launch configuration types.

Specified by:
validTypes in class AbstractLaunchTask
Returns:
A list of classes which are valid launch configuration types. Not null.