BatchTest (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.junit, class: BatchTest

# Class BatchTest

java.lang.Object
org.apache.tools.ant.taskdefs.optional.junit.BaseTest
org.apache.tools.ant.taskdefs.optional.junit.BatchTest

public final class BatchTest extends BaseTest

Create then run `JUnitTest`'s based on the list of files given by the fileset attribute.

Every `.java` or `.class` file in the fileset is assumed to be a testcase. A `JUnitTest` is created for each of these named classes with basic setup inherited from the parent `BatchTest`.

See Also:
  - `JUnitTest`

- ## Field Summary

  ### Fields inherited from class BaseTest

  `destDir, errorProperty, failureProperty, filtertrace, fork, formatters, haltOnError, haltOnFail, ifProperty, unlessProperty`
  Modifier and Type
  Field
  Description
  `protected File`
  `destDir`
  destination directory
  `protected String`
  `errorProperty`
  `protected String`
  `failureProperty`
  `protected boolean`
  `filtertrace`
  `protected boolean`
  `fork`
  `protected Vector<FormatterElement>`
  `formatters`
  `protected boolean`
  `haltOnError`
  `protected boolean`
  `haltOnFail`
  `protected String`
  `ifProperty`
  `protected String`
  `unlessProperty`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BatchTest(Project project)`
  create a new batchtest instance

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(ResourceCollection rc)`
  Add a new ResourceCollection instance to this batchtest.
  `void`
  `addFileSet(FileSet fs)`
  Add a new fileset instance to this batchtest.
  `Enumeration<JUnitTest>`
  `elements()`
  Return all `JUnitTest` instances obtain by applying the fileset rules.
  `static String`
  `javaToClass(String filename)`
  Convenient method to convert a pathname without extension to a fully qualified classname.

  ### Methods inherited from class BaseTest

  `addFormatter, getErrorProperty, getFailureProperty, getFiltertrace, getFork, getHaltonerror, getHaltonfailure, getIfCondition, getTodir, getUnlessCondition, isSkipNonTests, setErrorProperty, setFailureProperty, setFiltertrace, setFork, setHaltonerror, setHaltonfailure, setIf, setIf, setSkipNonTests, setTodir, setUnless, setUnless`
  Modifier and Type
  Method
  Description
  `void`
  `addFormatter(FormatterElement elem)`
  Allow a formatter nested element.
  `String`
  `getErrorProperty()`
  Get the failure property name.
  `String`
  `getFailureProperty()`
  Get the failure property name.
  `boolean`
  `getFiltertrace()`
  Get the filtertrace attribute.
  `boolean`
  `getFork()`
  Get the fork attribute.
  `boolean`
  `getHaltonerror()`
  Get the haltonerror attribute.
  `boolean`
  `getHaltonfailure()`
  Get the haltonfailure attribute.
  `Object`
  `getIfCondition()`
  The if expression
  `String`
  `getTodir()`
  Get the destination directory.
  `Object`
  `getUnlessCondition()`
  The unless expression
  `boolean`
  `isSkipNonTests()`
  `void`
  `setErrorProperty(String errorProperty)`
  Set the name of the error property.
  `void`
  `setFailureProperty(String failureProperty)`
  Set the name of the failure property.
  `void`
  `setFiltertrace(boolean value)`
  Set the filtertrace attribute.
  `void`
  `setFork(boolean value)`
  Set the fork attribute.
  `void`
  `setHaltonerror(boolean value)`
  Set the haltonerror attribute.
  `void`
  `setHaltonfailure(boolean value)`
  Set the haltonfailure attribute.
  `void`
  `setIf(Object ifCondition)`
  Set the if attribute.
  `void`
  `setIf(String propertyName)`
  Set the if attribute.
  `void`
  `setSkipNonTests(boolean skipNonTests)`
  `void`
  `setTodir(File destDir)`
  Sets the destination directory.
  `void`
  `setUnless(Object unlessCondition)`
  Set the unless attribute.
  `void`
  `setUnless(String propertyName)`
  Set the unless attribute.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BatchTest

    public BatchTest(Project project)
    create a new batchtest instance
    Parameters:
      `project` - the project it depends on.

- ## Method Details

  - ### addFileSet

    public void addFileSet(FileSet fs)
    Add a new fileset instance to this batchtest. Whatever the fileset is, only filename that are `.java` or `.class` will be considered as 'candidates'.
    Parameters:
      `fs` - the new fileset containing the rules to get the testcases.

  - ### add

    public void add(ResourceCollection rc)
    Add a new ResourceCollection instance to this batchtest. Whatever the collection is, only names that are `.java` or `.class` will be considered as 'candidates'.
    Parameters:
      `rc` - the new ResourceCollection containing the rules to get the testcases.
    Since:
      Ant 1.7

  - ### elements

    public Enumeration<JUnitTest> elements()
    Return all `JUnitTest` instances obtain by applying the fileset rules.
    Returns:
      an enumeration of all elements of this batchtest that are a `JUnitTest` instance.

  - ### javaToClass

    public static String javaToClass(String filename)
    Convenient method to convert a pathname without extension to a fully qualified classname. For example `org/apache/Whatever` will be converted to `org.apache.Whatever`
    Parameters:
      `filename` - the filename to "convert" to a classname.
    Returns:
      the classname matching the filename.