FeaturesPluginsDocs & SupportCommunityPartners

XTest Custom Ant Tasks

Version: 1.5
Last update: 17/01/2004
Authors: Martin Brehovsky, Milan Kubec

Abstract: This document describes custom ant tasks used in XTest framework. Please note, these tasks are internal to XTest, so they can change without a prior notice. You should not use them in your build scripts (unless you are a plugin developer). To see tasks available for XTest users, please see this document.

Tasks used in harness

  • this part describes tasks used in harness itself.
 Task name: nbtaskdef  Class name: org.netbeans.xtest.NbMultiTaskDef
 Description: XTest replacement of <taskdef> task.
 Attributes
 name  name of defined task
 classname  name of class, which defines task
 classpath  classpath to look for given class

 Task name: test-configurator  Class name: org.netbeans.xtest.MTestConfigurator
 Description: Task reads config file named cfg-[testtype].xml and it selects all testbags which conforms to passed test attributes and have specified compilers/executors. Then all conforming tests are stored to static HashMap. Also all definitions of executors and results processors are stored.
 Attributes
 testtype  name of testtype used to form a file name of actual config - cfg-[testtype].xml
 testattributes  all test attributes, which has to be satisfied by selected tests (testbags)
 testexecutors  all test executors used to execute tests
patternsetattribs
defined patterns of ?????
testbags
if defined, testbags listed in this property will be selected
testconfig
 
singletest
when defined, it creates a empty testbag which will include the singletest. Please note, the empty testbag will use the same compiler/executor as the testbag either specified by testbags attribute, or the testbag selected by standard attributes
 Elements
patternset  

 Task name: test-executor  Class name: org.netbeans.xtest.MTestExecutor
 Description: This task calls test executor (executor is defined as ant build script and target in that script) defined in cfg file and passes all needed information to the executor via properties, where names of these properties are values of elements of this task. This task reads structures filled by <test-configurator> task
 Attributes
 paramClasspathProp  property, which will contain classpath for selected testbag
paramExecutorProp
 
paramTimeoutProp
 
 paramTestConfigProp  property, which will contain name of executed test
 paramNameProp  property, which will contain name of selected testbag (currently being executed)
resultsDir
directory which identifies directory where results are stored
workDir
directory, which identifies a working directory for XTest

 Task name: test-compiler  Class name: org.netbeans.xtest.MTestCompiler
 Description: This task calls test compiler (compilers defined as ant build script and target in that script) defined in cfg file and passes all needed information to the compiler via properties, where names of these properties are values of elements of this task. This task reads structures filled by <test-configurator> task
 Attributes
 paramClasspathProp  property, which will contain classpath for selected testbag
 paramTestConfigProp  property, which will contain name of executed test
 paramNameProp  property, which will contain name of selected testbag (currently being executed)

 Task name: nbpath  Class name: org.netbeans.xtest.NbPath
 Description: This task looks for required products, like JDK and sets ant properties with the found values
 Attributes
jdkHomePropertyName
name of the property which will be filled with jdk home directory

 Task name: jar-finder  Class name: org.netbeans.xtest.JarFinder
 Description: Task which search for specified jars in given directories and fills out the specified property with full paths to these jars.
 Attributes
dirs
a list of directories where jars will be searched
files
a list of jars to be searched
property
a name of the property which will contains found jars with full paths.

 Task name: nbpatternset  Class name: org.netbeans.xtest.NbPatternset
 Description: task merges together nested patternsets and patternset refereced by the id attribute. If patternset denoted by id attribute doesn't exist new one is created and added among project references.
 Attributes
 useid  id which will be used to reference defined patternset
 Elements
 patternset  this is "standard" ant <patternset> data type

 Task name: pathdef  Class name: org.netbeans.xtest.PathDef
 Description: Creates reference in current project to specified path.
 Attributes
 useid  id which will be used to reference defined path
 Elements
 path  this is "standard" ant <path> data type

 Task name: write-property  Class name: org.netbeans.xtest.UserPropertyWriter
 Description: Task which parses all user properties (i.e. properties which start with 'xtest.userdata(attrib)|' string) based on current xtest attributes and stores them in a file, which is then loaded by the JVM which runs the tests.
 Attributes
propertyPrefix
prefix of properties to be considered as a candidate for inclusion
attribs
which attributes the properties need to contain to be included
file
file to which all relevant properties are stored

 Task name: for  Class name: org.netbeans.xtest.driver.ForTask
 Description: Task which behave as for each command. It executes inner elements for each property it can get from the supplied list.
 Attributes

list

list of properties
property
property name to which the actual property is be stored
delimiter delimiter which is used to

 Task name: testruninfo  Class name: org.netbeans.xtest.pe.TestRunInfoTask
 Description: creates information about currently executed test run and saves it to a XML file
 Attributes
outfile
file which will contain the information in XML format
config
name of the currently executed configuration
name
name of the test run

 

 Task name: testbaginfo  Class name: org.netbeans.xtest.pe.TestBagInfoTask
 Description: creates information about currently executed testbag and saves it to a XML file
 Attributes
name
name of the testbag
testType
current test type (e.g. unit, qa-functional)
testAttribs current testattribs
executor executor for this testbag
module module, which contains this testbag
outfile file which will contain the information in XML format

 

 Task name: regenerateXML  Class name: org.netbeans.xtest.pe.RegenerateXMLTask
 Description: regenerates XML files, so all references are up to date. This task need to be run when there are any changes (additions/deletions) in the results directory.
 Attributes
inputDir
results directory with XML files
serverUsage
if set to true, this task is running on server (it behaves in a bit different way than when running standalone)

 

 Task name: transformXML  Class name: org.netbeans.xtest.pe.TransformXMLTask
 Description: task for transforming results XML files to HTML files.
 Attributes
inputDir
results dir with input XML files
outputDir
results dir with output HTML files

 

 Task name: printSummary  Class name: org.netbeans.xtest.pe.PrintSummary
 Description: task for printing our summary from test results
 Attributes
resultsDir
the location of the results directory

 

 Task name: getResultsDirs  Class name: org.netbeans.xtest.pe.GetResultsDirsTask
 Description: task for getting the current directory where tests should store their results
 Attributes
testRunDirProperty
the property name, where task will store value of results directory for the test run currently being executed

 

 Task name: pluginsInit  Class name: org.netbeans.xtest.plugin.PluginsInitTask
 Description: task initalizes XTest plugins and stores their representation to memory, so other plugin related tasks can access this information without unnecessary overhead
 Attributes
pluginsHome
home directory of the installed plugins.
preferredPlugins
preferred plugins (for details see plugins document)

 

 Task name: pluginExecute  Class name: org.netbeans.xtest.plugin.PluginExecuteTask
 Description: task for executing an action supplied by the given plugin
 Attributes
pluginName
plugin to be executed
executeType
what type of action will be executed
executeAction
which action supplied by the plugin will be executed

 

Tasks used in instance harness

  • this sections describes tasks used in instance harness (part of XTest capable of running tests across several modules in a CVS repository)
 Task name: master-config  Class name: org.netbeans.xtest.NbTestConfig
 Description: Task responsible to read/parse master config and selecting appropriate configuration of tests to be run
 Attributes
config config to be selected
file file which contains master config file

 

 Task name: xtest-runner  Class name: org.netbeans.xtest.NbExecutor
 Description: Task responsible for lauching the testing process of the given module. It basically starts a new ant script (ant -f ${module}/test/build.xml) ${target.name}) a
 Attributes
targetname which target is supposed to be executed
targetParamModule which module should be executed
targetParamTesttype which testtype should be executed
targetParamTestAttributes which attributes should be used to select tests to be executed
runningMode need to be set to run to be working. More info needed ...
testRun a file to which will be output redirected

 

Tasks used in XTest Driver

  • please note, XTest Driver is deprecated part of XTest. It will be replaced by more sophisticated solution soon, so this section currently does not contain any described tasks. For details please see source code of driver in src/org/netbeans/xtest/driver
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