FeaturesPluginsDocs & SupportCommunityPartners

XTest Users Custom Ant Tasks

Version: 1.0
Last update: 17/01/2004
Authors: Martin Brehovsky


This document describes tasks, which are supposed to be used by users in their build scripts.

Tasks used in the main build script

  • this part describes tasks used in harness itself.
Task name: xtest Class name: org.netbeans.xtest.usertasks.XTestActionTask
Description: This task is a front-end for all xtest actions called from build scripts. It is able to start test compilation, start test execution, clean tests and results, print out XTest version , ...
Attributes
 executeAction   action which XTest should execute. Available actions are:
  • buildTests - to build tests classes
  • runTests - to run tests (and build if they are not already built)
  • cleanTests - to clean test classes
  • cleanResults - to clean all results
  • cleanAll - to clealn test classes and also all results
  • version - to print out the version of currently used XTest
  • generateFailedConfig - to generate test configuration with failed tests (based on the test report)
  • generateExcludedConfig - to generate test configuration with excluded tests
 xtestHome  optional attribute - sets XTest home for this action. If not defined, system property called xtest.home is used.

 

Tasks used in compilers/executors

  • this part describes tasks to be used by users in their tests custom compilers/executors
Task name: buildTests Class name: org.netbeans.xtest.usertasks.BuildTestsTask
Description: task which compiles tests and packages them to xtest test archive (.xar file). Usually you will use this task, which does both compilation and packaging of tests. However in cases when you need to provide a special compilation, packaging or you need to perform some processing of compiled classes before packaging them, you can use compileTests and packageTests tasks (described below).
Attributes
pluginName plugin to be used to perform the compile action - if not defined the 'base' plugin will be used
actionID name (ID) of the compile action to be run - if not defined, the default compiler will be executed
srcDir
directory with test sources
classPath
classpath used for compilation. This attribute understands only simple properties. If you need to use references (e.g. results from path ant task), you should use nested element called <classPath>. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
compileExcludes which files should be excluded from compilation (usually you need this property if you include some dummy java sources, which are used as data when running the tests)
debug true if the tests should be compiled with debug information (false by default)
deprecate true if the compilation should show information about usage of deprecated classes/methods (false by default)
packageIncludes
additional files to be included in tests archive (you can specify standard ant wildcard expression). By default are included files which satisfy filters listed in ${xtest.home}/standard-test-includes.txt. Please note, this attribute only appends additional filters.
packageExcludes
extra excludes for packaging process. By default excludes defined in ${xtest.home}/standard-test-excludes.txt are used. As with includes attribute, it only appends additional exclude filters.
Elements
classpath
inner element used to define classpath for compilation. This element uses exactly the same syntax as ant's <javac> task, so for details please see ant documentation. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
property you can specify additional properties for the build action (many plugins use additional properties to allow user to set their additional features, for details see each plugin documen)

 

Task name: executeTests Class name: org.netbeans.xtest.usertasks.ExecuteTestsTask
Description: task which executes tests in a given
Attributes
pluginName plugin to be used to perform the execute action - this should be always defined (there is no default)
actionID name (ID) of the compile action to be run - if not defined, the default executor from the plugin will be executed
classPath
classpath used for test execution. This attribute understands only simple properties. If you need to use references (e.g. classpath defined via path ant task), you should use nested element called <classpath>. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
testMode test mode used to run the tests. Allowed values are 'testsuite' to run each test suite in its own VM, or 'testbag' to run the whole testbag in a single VM. This attribute is set default differently by each plugin. JVM plugin uses 'testsuite' value as default, IDE plugin uses 'testbag' value as default.
Elements
classpath
inner element used to define classpath for test execution. This element uses exactly the same syntax as ant's <javac> task, so for more details please see ant documentation. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
property you can specify additional properties for the build action (many plugins use additional properties to allow user to set their additional features, for details see each plugin documentation)

 

Task name: compileTests Class name: org.netbeans.xtest.usertasks.CompileTestsTask
Description: this task should be used in your custom compiler target and runs the compiler supplied by the given plugin. Please note, this task performs only compilation, you will need very likely also to package tests. See also packageTests and buildTests tasks.
Attributes
pluginName plugin to be used to perform the compile action - if not defined the 'base' plugin will be used
actionID name (ID) of the compile action to be run - if not defined, the default compiler will be executed
srcDir
directory with test sources
classPath
classpath used for compilation. This attribute understands only simple properties. If you need to use references (e.g. classpath defined by the path ant task), you should use nested element called <classpath>. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
compileExcludes which files should be excluded from compilation (usually you need this property if you include some dummy java sources, which are used as data when running the tests)
debug true if the tests should be compiled with debug information (false by default)
deprecate true if the compilation should show information about usage of deprecated classes/methods (false by default)
Elements
classpath
inner element used to define classpath for compilation. This element uses exactly the same syntax as ant's <javac> task, so for more details please see ant documentation. Please note, JUnit framework and NbJUnit extensions are added automatically to the classpath, there is no need to explicitly add them.
property you can specify additional properties for the build action (many plugins use additional properties to allow user to set their additional features, for details see each plugin documentation)

 

Task name: packageTests Class name: org.netbeans.xtest.usertasks.PackageTestsTask
Description: this task should be used in your custom compiler target and runs the packager supplied by the given plugin. Please note, this task performs only test packaging (without compilation), you will need very likely also to compile tests prior to packaging. See also compileTests and buildTests tasks.
Attributes
pluginName plugin to be used to perform the compile action - if not defined the 'base' plugin will be used
actionID name (ID) of the compile action to be run - if not defined, the default compiler will be executed
includes
additional files to be included in tests archivempase(you can specify standard ant wildcard expression). By default are included files which satisfy filters listed in ${xtest.home}/standard-test-includes.txt. Please note, this attribute only appends additional filters.
excludes
extra excludes for packaging process. By default excludes defined in ${xtest.home}/standard-test-excludes.txt are used. As with includes attribute, it only appends additional exclude filters.
Elements
property you can specify additional properties for the build action (many plugins use additional properties to allow user to set their additional features, for details see each plugin documentation)

 

 

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by