com.beust.testng
Class TestNGAntTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.Java
              extended by com.beust.testng.TestNGAntTask

public class TestNGAntTask
extends org.apache.tools.ant.taskdefs.Java

The TestNG task is just a paper-thin veneer on top of the class for now properties it takes are suiteRunnerClass - the suite runner to use. defaults to com.beust.testng.SuiteRunner outputDir - output directory testClass - run just a single test class, without need for propertyFile testJar - run out of a jar, looking for testng.xml by default propertyFile - nestable list of test property files names sourcedir - source directory (in case javadoc annotation are to be used) sourcepathref - path reference for source directories src - nestable Path-like for source directory

Version:
$Id: TestNGAntTask.java,v 1.5 2005/02/22 01:56:04 cedric Exp $
Author:
Jolly Chen. August 27, 2004, the_mindstorm

Field Summary
protected  org.apache.tools.ant.types.Path m_classpath
           
protected  boolean m_dumpCommand
           
protected  java.lang.String m_outdir
           
protected  org.apache.tools.ant.types.Path m_srcPath
           
protected  java.lang.String m_testclass
           
protected  java.lang.String m_testjar
           
protected  java.lang.String outputDir
           
protected  java.lang.String suiteRunnerClass
           
 
Fields inherited from class org.apache.tools.ant.taskdefs.Java
redirector, redirectorElement
 
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
TestNGAntTask()
           
 
Method Summary
 void addConfiguredFileSet(org.apache.tools.ant.types.FileSet fileSet)
          Support for nested
 org.apache.tools.ant.types.Path createSrc()
          Creates a nested src Path like.
 void execute()
          execute the suite runner class
 org.apache.tools.ant.types.FileSet getFileSet()
           
 void setClasspath(org.apache.tools.ant.types.Path s)
          Set the classpath to be used when running the Java class
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Classpath to use, by reference.
 void setDumpCommand(boolean verbose)
          Sets the flag to log the command line.
 void setOutputDir(java.lang.String s)
          Sets the test output directory
 void setSourcedir(org.apache.tools.ant.types.Path srcDir)
          Sets the Path like for source directories.
 void setSourcepathRef(org.apache.tools.ant.types.Reference r)
          Sets a reference to a Path-like structure for source directories.
 void setSrc(org.apache.tools.ant.types.Path sourcepath)
          Sets the Path like for source directories.
 void setSuiteRunnerClass(java.lang.String s)
          Sets the suite runner class to invoke
 void setTestClass(java.lang.String s)
          Sets the test class
 void setTestJar(java.lang.String s)
          Sets the test jar
 
Methods inherited from class org.apache.tools.ant.taskdefs.Java
addAssertions, addConfiguredRedirector, addEnv, addSysproperty, addSyspropertyset, clearArgs, createArg, createBootclasspath, createClasspath, createJvmarg, createPermissions, createWatchdog, executeJava, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, maybeSetResultPropertyValue, run, setAppend, setArgs, setClassname, setDir, setError, setErrorProperty, setFailonerror, setFork, setInput, setInputString, setJar, setJvm, setJvmargs, setJVMVersion, setLogError, setMaxmemory, setNewenvironment, setOutput, setOutputproperty, setResultProperty, setSpawn, setTimeout, setupRedirector
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, 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
 

Field Detail

suiteRunnerClass

protected java.lang.String suiteRunnerClass

outputDir

protected java.lang.String outputDir

m_srcPath

protected org.apache.tools.ant.types.Path m_srcPath

m_dumpCommand

protected boolean m_dumpCommand

m_outdir

protected java.lang.String m_outdir

m_testclass

protected java.lang.String m_testclass

m_testjar

protected java.lang.String m_testjar

m_classpath

protected org.apache.tools.ant.types.Path m_classpath
Constructor Detail

TestNGAntTask

public TestNGAntTask()
Method Detail

setDumpCommand

public void setDumpCommand(boolean verbose)
Sets the flag to log the command line.


setSuiteRunnerClass

public void setSuiteRunnerClass(java.lang.String s)
Sets the suite runner class to invoke

Parameters:
s - the name of the suite runner class

setOutputDir

public void setOutputDir(java.lang.String s)
Sets the test output directory

Parameters:
s - the name of directory

setTestClass

public void setTestClass(java.lang.String s)
Sets the test class

Parameters:
s - the name of testclass

setSourcedir

public void setSourcedir(org.apache.tools.ant.types.Path srcDir)
Sets the Path like for source directories.

Parameters:
srcDir - path for source directories

setSrc

public void setSrc(org.apache.tools.ant.types.Path sourcepath)
Sets the Path like for source directories.

Parameters:
sourcepath - path for source directories

createSrc

public org.apache.tools.ant.types.Path createSrc()
Creates a nested src Path like.

Returns:
a new Path

setSourcepathRef

public void setSourcepathRef(org.apache.tools.ant.types.Reference r)
Sets a reference to a Path-like structure for source directories.

Parameters:
r - reference to a Path representing the source directories

setTestJar

public void setTestJar(java.lang.String s)
Sets the test jar

Parameters:
s - the name of test jar

addConfiguredFileSet

public void addConfiguredFileSet(org.apache.tools.ant.types.FileSet fileSet)
Support for nested


getFileSet

public org.apache.tools.ant.types.FileSet getFileSet()

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path s)
Set the classpath to be used when running the Java class

Overrides:
setClasspath in class org.apache.tools.ant.taskdefs.Java
Parameters:
s - an Ant Path object containing the classpath.

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Classpath to use, by reference.

Overrides:
setClasspathRef in class org.apache.tools.ant.taskdefs.Java
Parameters:
r - a reference to an existing classpath

execute

public void execute()
             throws org.apache.tools.ant.BuildException
execute the suite runner class

Overrides:
execute in class org.apache.tools.ant.taskdefs.Java
Throws:
org.apache.tools.ant.BuildException - if failOnError is set to true and the application returns a non 0 result code