org.apache.tools.ant.taskdefs.optional.junit
Class JUnitTask

java.lang.Object
  |
  +--org.apache.tools.ant.Task
        |
        +--org.apache.tools.ant.taskdefs.optional.junit.JUnitTask

public class JUnitTask
extends Task

Ant task to run JUnit tests.

JUnit is a framework to create unit test. It has been initially created by Erich Gamma and Kent Beck. JUnit can be found at http://www.junit.org.

To spawn a new Java VM to prevent interferences between different testcases, you need to enable fork.

Author:
Thomas Haas, Stefan Bodewig

Fields inherited from class org.apache.tools.ant.Task
description, location, project, target, taskName, taskType, wrapper
 
Constructor Summary
JUnitTask()
          Creates a new JUnitRunner and enables fork of a new Java VM.
 
Method Summary
 void addFormatter(FormatterElement fe)
           
 void addTest(JUnitTest test)
           
protected  java.util.Enumeration allTests()
           
 BatchTest createBatchTest()
           
 Path createClasspath()
           
 Commandline.Argument createJvmarg()
           
protected  ExecuteWatchdog createWatchdog()
           
 void execute()
          Runs the testcase.
 void setDir(java.io.File dir)
          The directory to invoke the VM in.
 void setFork(boolean value)
           
 void setHaltonerror(boolean value)
           
 void setHaltonfailure(boolean value)
           
 void setJvm(java.lang.String value)
           
 void setMaxmemory(java.lang.String max)
           
 void setPrintsummary(boolean value)
           
 void setTimeout(java.lang.Integer value)
           
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUnitTask

public JUnitTask()
          throws java.lang.Exception
Creates a new JUnitRunner and enables fork of a new Java VM.
Method Detail

setHaltonerror

public void setHaltonerror(boolean value)

setHaltonfailure

public void setHaltonfailure(boolean value)

setPrintsummary

public void setPrintsummary(boolean value)

setMaxmemory

public void setMaxmemory(java.lang.String max)

setTimeout

public void setTimeout(java.lang.Integer value)

setFork

public void setFork(boolean value)

setJvm

public void setJvm(java.lang.String value)

createJvmarg

public Commandline.Argument createJvmarg()

createClasspath

public Path createClasspath()

addTest

public void addTest(JUnitTest test)

createBatchTest

public BatchTest createBatchTest()

addFormatter

public void addFormatter(FormatterElement fe)

setDir

public void setDir(java.io.File dir)
The directory to invoke the VM in.

Ignored if fork=false.


execute

public void execute()
             throws BuildException
Runs the testcase.
Overrides:
execute in class Task
Following copied from class: org.apache.tools.ant.Task
Throws:
BuildException - if someting goes wrong with the build

createWatchdog

protected ExecuteWatchdog createWatchdog()
                                  throws BuildException

allTests

protected java.util.Enumeration allTests()


Copyright © 2000 Apache Software Foundation. All Rights Reserved.