Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jxcl.jxunit.frontend.ant
Class JXunitTask  view JXunitTask download JXunitTask.java

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.jxcl.jxunit.frontend.ant.JXunitTask

public class JXunitTask
extends org.apache.tools.ant.Task

Ant task for running JXunit and JUnit.

The JXunit Ant task is meant to be a plug-in replacement for the Ant JUnitTask. Whatever build.xml works with JUnitTask should behave identically with JXunitTask. The opposite is not true: using JXunitTask allows you to run coverage tests in addition to JUnit unit tests

Parameter names / build file options are compatible with the build.xml options for JUnitTask as of Ant 1.5.3-1, so that if <junit> and </junit> are replaced with <jxunit> and </jxunit> respectively in the build.xml file, test behavior should be the same.

Build file options either control the individual test and so are passed to JXunit and JUnit, or manage JXunitTask and the test process.

Most test options will go through JXunit to JUnit. All are set by Ant set* methods, where the name for the method setting the variable 'var' is 'setVar'. That is, the first letter of the variable name is capitalized, then the modified name is appended to 'set'.

Task control parameters are NOT passed through to JXunit or JUnit. These variables are modified by Ant add*, set*, and create* routines, where the names are determined as described above.

JXunitTest options can be set at three levels. First, then can be set as attributes to the <jxunit&gr; element. In this case, they are the defaults for all tests.

Next, they can be set at the <batchtest> leve.. In this case, these attributes will be used for all files in the batch test.

Finally, they can be set at the <test> level, in which case they will override the defaults set higher up.

JXunitTask collects filesets from batch test elements and the names of individual tests. These are then passed to a Scheduler which unpacks the batch tests and schedules all tests for running.

It may be important to understand that under certain circumstances batches of tests will be run more than once result. This will normally be the result of an error in the way that dependencies are structured in build.xml.


Field Summary
private  org.apache.tools.ant.types.Path antRuntimeClasses
           
private  boolean firstTimeThrough
           
private  boolean includeAntRuntime
           
private  org.jxcl.jxunit.framework.JXunitTest jxt
           
private  MockExec mockE
           
private  boolean mockery
           
private  Scheduler sch
           
private  TaskControl tc
           
private  TestExec testE
           
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
JXunitTask()
           
 
Method Summary
protected  void addClasspathEntry(java.lang.String resource)
           
private  void addCPEs()
           
 void addEnv(org.apache.tools.ant.types.Environment.Variable var)
           
 void addFormatter(org.jxcl.jxunit.reports.FmtSelector fe)
           
 void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
           
 void addTest(org.jxcl.jxunit.framework.JXunitTest jxt)
           
 BatchTest createBatchTest()
           
 org.apache.tools.ant.types.Path createClasspath()
           
 org.apache.tools.ant.types.Commandline.Argument createJvmarg()
           
 void execute()
          Called by the project to let the task do its work.
 void handleTheErrorFlush(java.lang.String line)
           
 void handleTheErrorOutput(java.lang.String line)
           
 void handleTheFlush(java.lang.String line)
           
 void handleTheOutput(java.lang.String line)
           
 void init()
          Called by the project to let the task initialize properly.
 void setCheckCoverage(boolean b)
           
 void setCheckExcludes(java.lang.String s)
           
 void setCheckIncludes(java.lang.String s)
           
 void setDir(java.io.File dir)
           
 void setErrorProperty(java.lang.String propertyName)
           
 void setFailureProperty(java.lang.String propertyName)
           
 void setFiltertrace(boolean b)
           
 void setFork(boolean b)
           
 void setHaltOnError(boolean b)
           
 void setHaltOnFailure(boolean b)
           
 void setIncludeAntRuntime(boolean b)
           
 void setJvm(java.lang.String value)
           
 void setMaxmemory(java.lang.String max)
           
 void setMockExec(boolean b)
           
 void setMockTestRun(boolean b)
           
 void setNewenvironment(boolean b)
           
 void setPrintsummary(java.lang.String sValue)
           
 void setShowOutput(boolean b)
           
 void setTalk(java.lang.String s)
           
 void setTimeout(java.lang.Long t)
           
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sch

private Scheduler sch

tc

private TaskControl tc

includeAntRuntime

private boolean includeAntRuntime

antRuntimeClasses

private org.apache.tools.ant.types.Path antRuntimeClasses

jxt

private org.jxcl.jxunit.framework.JXunitTest jxt

mockE

private MockExec mockE

testE

private TestExec testE

mockery

private boolean mockery

firstTimeThrough

private boolean firstTimeThrough
Constructor Detail

JXunitTask

public JXunitTask()
           throws java.lang.Exception
Method Detail

setCheckCoverage

public void setCheckCoverage(boolean b)

setCheckExcludes

public void setCheckExcludes(java.lang.String s)

setCheckIncludes

public void setCheckIncludes(java.lang.String s)

setErrorProperty

public void setErrorProperty(java.lang.String propertyName)

setFailureProperty

public void setFailureProperty(java.lang.String propertyName)

setFiltertrace

public void setFiltertrace(boolean b)

setFork

public void setFork(boolean b)

setHaltOnError

public void setHaltOnError(boolean b)

setHaltOnFailure

public void setHaltOnFailure(boolean b)

setMockTestRun

public void setMockTestRun(boolean b)

setShowOutput

public void setShowOutput(boolean b)

setTalk

public void setTalk(java.lang.String s)

createBatchTest

public BatchTest createBatchTest()

createClasspath

public org.apache.tools.ant.types.Path createClasspath()

setDir

public void setDir(java.io.File dir)

addEnv

public void addEnv(org.apache.tools.ant.types.Environment.Variable var)

addFormatter

public void addFormatter(org.jxcl.jxunit.reports.FmtSelector fe)

setIncludeAntRuntime

public void setIncludeAntRuntime(boolean b)

setJvm

public void setJvm(java.lang.String value)

createJvmarg

public org.apache.tools.ant.types.Commandline.Argument createJvmarg()

setMaxmemory

public void setMaxmemory(java.lang.String max)

setMockExec

public void setMockExec(boolean b)

setNewenvironment

public void setNewenvironment(boolean b)

setPrintsummary

public void setPrintsummary(java.lang.String sValue)

addSysproperty

public void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)

addTest

public void addTest(org.jxcl.jxunit.framework.JXunitTest jxt)

setTimeout

public void setTimeout(java.lang.Long t)

addCPEs

private void addCPEs()

init

public void init()
Description copied from class: org.apache.tools.ant.Task
Called by the project to let the task initialize properly. The default implementation is a no-op.


execute

public void execute()
             throws org.apache.tools.ant.BuildException
Description copied from class: org.apache.tools.ant.Task
Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.


addClasspathEntry

protected void addClasspathEntry(java.lang.String resource)

handleTheOutput

public void handleTheOutput(java.lang.String line)

handleTheFlush

public void handleTheFlush(java.lang.String line)

handleTheErrorOutput

public void handleTheErrorOutput(java.lang.String line)

handleTheErrorFlush

public void handleTheErrorFlush(java.lang.String line)