org.jtiger.ant
Class JTigerTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.jtiger.ant.JTigerTask

public final class JTigerTask
extends org.apache.tools.ant.Task

An Apache Ant task for performing a test execution run from an Ant build.
An example excerpt of an Ant build file that uses this task:

 <target name="test" description="Execute JTiger tests">
     <mkdir dir="test-report"/>
     <taskdef name="jtiger" classname="org.jtiger.ant.JTigerTask" classpathref="project.class.path"/>

     <jtiger haltonfailure="true">
         <category regex="DatabaseTest"/>
         <fixtures>
             <fixture classname="com.foo.AdditionalTestFixture"/>
             <fileset dir="test-src">
                 <include name="**/*.java"/>
             </fileset>
         </fixtures>
         <result name="~html">
             <param value="test-report"/>
         </result>
         <java>
             <classpath refid="project.class.path"/>
         </java>
     </jtiger>
 </target>

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris
See Also:
Category, Fixture, Fixtures, Java, Result

Field Summary
 
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
JTigerTask()
          Create a default JTigerTask.
 
Method Summary
 Category createCategory()
          Creates a Category.
 Fixtures createFixtures()
          Creates a Fixtures.
 Java createJava()
          Creates a Java.
 Result createResult()
          Creates a Result.
 void execute()
          Executes the Ant task by calling Java.execute() and passing the set arguments to FixturesRunnerMain.main(String[]).
 void setDefinitionClass(String definitionClass)
          Sets the test definition class name for this task.
 void setHaltOnFailure(boolean haltOnFailure)
          Sets the halt on failure attribute for this task.
 void setJUnit(boolean jUnit)
          Sets the junit attribute for this task.
 void setSutdClass(String sutdClass)
          Sets the set up/tear down class name for this task.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, 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
 

Constructor Detail

JTigerTask

public JTigerTask()
Create a default JTigerTask.

Method Detail

createFixtures

public Fixtures createFixtures()
Creates a Fixtures.

Returns:
A new Fixtures.

setDefinitionClass

public void setDefinitionClass(String definitionClass)
Sets the test definition class name for this task.

Parameters:
definitionClass - The test definition class name for this task.
See Also:
FixturesRunnerConfig.getDefinitionClass(), TestDefinition

setSutdClass

public void setSutdClass(String sutdClass)
Sets the set up/tear down class name for this task.

Parameters:
sutdClass - The set up/tear down class name for this task.
See Also:
FixturesRunnerConfig.getSutdClass(), SetUpTearDown

createCategory

public Category createCategory()
Creates a Category.

Returns:
A new Category.

setHaltOnFailure

public void setHaltOnFailure(boolean haltOnFailure)
Sets the halt on failure attribute for this task.

Parameters:
haltOnFailure - The halt on failure attribute for this task.
See Also:
FixturesRunnerConfig.isHaltOnFailure()

setJUnit

public void setJUnit(boolean jUnit)
Sets the junit attribute for this task. Setting this value to true overrides any values set for setDefinitionClass(String) and setSutdClass(String). Set this attribute to execute JUnit unit test cases.

Parameters:
jUnit - The junit attribute for this task.

createResult

public Result createResult()
Creates a Result.

Returns:
A new Result.

createJava

public Java createJava()
Creates a Java.

Returns:
A new Java.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Executes the Ant task by calling Java.execute() and passing the set arguments to FixturesRunnerMain.main(String[]). These parameters are set by specifying attributes and elements in the Ant build file.

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException -
  • If the <java> element is not present in the Ant build file.
  • If the <fixtures> element is not present in the Ant build file.
  • If the <fixtures> element does not contain any classes from <fixture> or <fileset> subelements in the Ant build file.
  • If a <fixture> element does not contain a classname attribute in the Ant build file.
  • If a <category> element does not contain a regex attribute in the Ant build file.
  • If a <result> element does not contain a type attribute in the Ant build file.
  • If a <result> element does not contain a destination attribute in the Ant build file.
  • If a <result> element contains a destination attribute that is an invalid value in the Ant build file.