org.scalatest.tools

class ScalaTestAntTask

[source: org/scalatest/tools/ScalaTestAntTask.scala]

class ScalaTestAntTask
extends org.apache.tools.ant.Task with AnyRef

An ant task to run ScalaTest. Instructions on how to specify various options are below. See the scaladocs for the Runner class for a description of what each of the options does.

To use the ScalaTest ant task, you must first define it in your ant file using taskdef. Here's an example:

  <path id="scalatest.classpath">
    <pathelement location="${lib}/scalatest.jar"/>
    <pathelement location="${lib}/scala-library.jar"/>
  </path>

  <target name="main" depends="dist">
    <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
      <classpath refid="scalatest.classpath"/>
    </taskdef>

    <scalatest ...
  </target>
 

Once defined, you use the task by specifying information in a scalatest element:

   <scalatest ...>
     ...
   </scalatest>
 

You can place key value pairs into the configMap using nested <config> elements, like this:

   <scalatest>
     <config name="dbname" value="testdb"/>
     <config name="server" value="192.168.1.188"/>
 

You can specify a runpath using either a runpath attribute and/or nested <runpath> elements, using standard ant path notation:

   <scalatest runpath="serviceuitest-1.1beta4.jar:myjini">
 
or
   <scalatest>
     <runpath>
       <pathelement location="serviceuitest-1.1beta4.jar"/>
       <pathelement location="myjini"/>
     </runpath>
 

To add a URL to your runpath, use a <runpathurl> element (since ant paths don't support URLs):

   <scalatest>
     <runpathurl url="http://foo.com/bar.jar"/>
 

You can specify reporters using nested <reporter> elements, where the type attribute must be one of the following:

Each may include a config attribute to specify the reporter configuration. Types file, xml and reporterclass require additional attributes filename, directory, and classname, respectively:

   <scalatest>
     <reporter type="stdout"        config="FAB"/>
     <reporter type="file"          filename="test.out"/>
     <reporter type="xml"           directory="target"/>
     <reporter type="reporterclass" classname="my.ReporterClass"/>
 

Specify tags to include and/or exclude using <tagsToInclude> and <tagsToExclude> elements, like this:

   <scalatest>
     <tagsToInclude>
         CheckinTests
         FunctionalTests
     </tagsToInclude>

     <tagsToExclude>
         SlowTests
         NetworkTests
     </tagsToExclude>
 

To specify suites to run, use either a suite attribute or nested <suite> elements:

   <scalatest suite="com.artima.serviceuitest.ServiceUITestkit">
 

or

   <scalatest>
     <suite classname="com.artima.serviceuitest.ServiceUITestkit"/>
 

To specify suites using members-only or wildcard package names, use either the membersonly or wildcard attributes, or nested <membersonly> or <wildcard> elements:

   <scalatest membersonly="com.artima.serviceuitest">
 

or

   <scalatest wildcard="com.artima.joker">
 

or

   <scalatest>
     <membersonly package="com.artima.serviceuitest"/>
     <wildcard package="com.artima.joker"/>
 

Use attribute parallel="true" to specify parallel execution of suites. (If the parallel attribute is left out or set to false, suites will be executed sequentially by one thread.) When parallel is true, you can include an optional numthreads attribute to specify the number of threads to be created in thread pool (e.g., numthreads="10").

Use attribute haltonfailure="true" to cause ant to fail the build if there's a test failure.

Use attribute fork="true" to cause ant to run the tests in a separate process.

When fork is true, attribute maxmemory may be used to specify the maximum memory size that will be passed to the forked jvm.  For example, the following setting will cause "-Xmx1280M" to be passed to the java command used to run the tests.

   <scalatest maxmemory="1280M">
 

When fork is true, nested <jvmarg> elements may be used to pass additional arguments to the forked jvm. For example, if you are running into 'PermGen space' memory errors, you could add the following jvmarg to bump up the JVM's MaxPermSize value:

   <jvmarg value="-XX:MaxPermSize=128m"/>
 
Author
George Berger
Direct Known Subclasses:
ScalaTestTask

Method Summary
def addConfiguredConfig (config : org.scalatest.tools.NameValuePair) : Unit
Sets values from nested element config.
def addConfiguredExcludes (excludes : org.scalatest.tools.TextElement) : Unit
Sets value from nested element excludes. The excludes attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the tagsToExclude attribute instead.
def addConfiguredIncludes (includes : org.scalatest.tools.TextElement) : Unit
Sets value from nested element includes. The includes attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the tagsToInclude attribute instead.
def addConfiguredJvmArg (arg : org.scalatest.tools.JvmArg) : Unit
Sets value from nested element jvmarg.
def addConfiguredMembersOnly (membersonly : org.scalatest.tools.PackageElement) : Unit
Sets value from nested element membersonly.
def addConfiguredProperty (property : org.scalatest.tools.NameValuePair) : Unit
Sets values from nested element property. The property attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the config attribute instead.
def addConfiguredReporter (reporter : org.scalatest.tools.ReporterElement) : Unit
Sets value from nested element reporter.
def addConfiguredRunpath (runpath : org.apache.tools.ant.types.Path) : Unit
Sets value from nested element runpath.
def addConfiguredRunpathUrl (runpathurl : org.scalatest.tools.RunpathUrl) : Unit
Sets value from nested element runpathurl.
def addConfiguredSuite (suite : org.scalatest.tools.SuiteElement) : Unit
Sets value from nested element suite.
def addConfiguredTagsToExclude (tagsToExclude : org.scalatest.tools.TextElement) : Unit
Sets value from nested element excludes.
def addConfiguredTagsToInclude (tagsToInclude : org.scalatest.tools.TextElement) : Unit
Sets value from nested element tagsToInclude.
def addConfiguredTestNGSuites (testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
Sets value from nested element testngsuites.
def addConfiguredWildcard (wildcard : org.scalatest.tools.PackageElement) : Unit
Sets value from nested element wildcard.
override def execute : Unit
Executes the task.
def setConcurrent (concurrent : Boolean) : Unit
Sets value of the concurrent attribute. Note: The concurrent attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the parallel attribute instead.
def setFork (fork : Boolean) : Unit
Sets value of the fork attribute.
def setHaltonfailure (haltonfailure : Boolean) : Unit
Sets value of the haltonfailure attribute.
def setMaxmemory (max : java.lang.String) : Unit
Sets value of the maxmemory attribute.
def setMembersonly (packageName : java.lang.String) : Unit
Sets value of membersonly attribute.
def setNumthreads (numthreads : Int) : Unit
Sets value of the numthreads attribute.
def setParallel (parallel : Boolean) : Unit
Sets value of the parallel attribute.
def setRunpath (runpath : org.apache.tools.ant.types.Path) : Unit
Sets value of the runpath attribute.
def setSuite (suite : java.lang.String) : Unit
Sets value of suite attribute.
def setTestNGSuites (testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
Sets value of the testngsuites attribute.
def setWildcard (packageName : java.lang.String) : Unit
Sets value of wildcard attribute.
Methods inherited from org.apache.tools.ant.Task
org.apache.tools.ant.Task.setOwningTarget, org.apache.tools.ant.Task.getOwningTarget, org.apache.tools.ant.Task.setTaskName, org.apache.tools.ant.Task.getTaskName, org.apache.tools.ant.Task.setTaskType, org.apache.tools.ant.Task.init, org.apache.tools.ant.Task.getRuntimeConfigurableWrapper, org.apache.tools.ant.Task.setRuntimeConfigurableWrapper, org.apache.tools.ant.Task.maybeConfigure, org.apache.tools.ant.Task.reconfigure, org.apache.tools.ant.Task.handleOutput, org.apache.tools.ant.Task.handleFlush, org.apache.tools.ant.Task.handleInput, org.apache.tools.ant.Task.handleErrorOutput, org.apache.tools.ant.Task.handleErrorFlush, org.apache.tools.ant.Task.log, org.apache.tools.ant.Task.log, org.apache.tools.ant.Task.log, org.apache.tools.ant.Task.log, org.apache.tools.ant.Task.perform, org.apache.tools.ant.Task.isInvalid, org.apache.tools.ant.Task.getTaskType, org.apache.tools.ant.Task.getWrapper, org.apache.tools.ant.Task.bindToOwner
Methods inherited from org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.ProjectComponent.setProject, org.apache.tools.ant.ProjectComponent.getProject, org.apache.tools.ant.ProjectComponent.getLocation, org.apache.tools.ant.ProjectComponent.setLocation, org.apache.tools.ant.ProjectComponent.setDescription, org.apache.tools.ant.ProjectComponent.getDescription, org.apache.tools.ant.ProjectComponent.clone
Methods inherited from AnyRef
getClass, hashCode, equals, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def execute : Unit
Executes the task.
Overrides
org.apache.tools.ant.Task.org.apache.tools.ant.Task.execute

def setRunpath(runpath : org.apache.tools.ant.types.Path) : Unit
Sets value of the runpath attribute.

def setHaltonfailure(haltonfailure : Boolean) : Unit
Sets value of the haltonfailure attribute.

def setFork(fork : Boolean) : Unit
Sets value of the fork attribute.

def setMaxmemory(max : java.lang.String) : Unit
Sets value of the maxmemory attribute.

def setTestNGSuites(testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
Sets value of the testngsuites attribute.

@scala.deprecated

def setConcurrent(concurrent : Boolean) : Unit
Sets value of the concurrent attribute. Note: The concurrent attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the parallel attribute instead.

def setNumthreads(numthreads : Int) : Unit
Sets value of the numthreads attribute.

def setParallel(parallel : Boolean) : Unit
Sets value of the parallel attribute.

def addConfiguredRunpath(runpath : org.apache.tools.ant.types.Path) : Unit
Sets value from nested element runpath.

def addConfiguredTestNGSuites(testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
Sets value from nested element testngsuites.

def addConfiguredRunpathUrl(runpathurl : org.scalatest.tools.RunpathUrl) : Unit
Sets value from nested element runpathurl.

def addConfiguredJvmArg(arg : org.scalatest.tools.JvmArg) : Unit
Sets value from nested element jvmarg.

@scala.deprecated

def addConfiguredProperty(property : org.scalatest.tools.NameValuePair) : Unit
Sets values from nested element property. The property attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the config attribute instead.

def addConfiguredConfig(config : org.scalatest.tools.NameValuePair) : Unit
Sets values from nested element config.

def setSuite(suite : java.lang.String) : Unit
Sets value of suite attribute.

def setMembersonly(packageName : java.lang.String) : Unit
Sets value of membersonly attribute.

def setWildcard(packageName : java.lang.String) : Unit
Sets value of wildcard attribute.

def addConfiguredSuite(suite : org.scalatest.tools.SuiteElement) : Unit
Sets value from nested element suite.

def addConfiguredMembersOnly(membersonly : org.scalatest.tools.PackageElement) : Unit
Sets value from nested element membersonly.

def addConfiguredWildcard(wildcard : org.scalatest.tools.PackageElement) : Unit
Sets value from nested element wildcard.

def addConfiguredReporter(reporter : org.scalatest.tools.ReporterElement) : Unit
Sets value from nested element reporter.

def addConfiguredTagsToInclude(tagsToInclude : org.scalatest.tools.TextElement) : Unit
Sets value from nested element tagsToInclude.

@scala.deprecated

def addConfiguredIncludes(includes : org.scalatest.tools.TextElement) : Unit
Sets value from nested element includes. The includes attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the tagsToInclude attribute instead.

def addConfiguredTagsToExclude(tagsToExclude : org.scalatest.tools.TextElement) : Unit
Sets value from nested element excludes.

@scala.deprecated

def addConfiguredExcludes(excludes : org.scalatest.tools.TextElement) : Unit
Sets value from nested element excludes. The excludes attribute has been deprecated and will be removed in a future version of ScalaTest. Please use the tagsToExclude attribute instead.


Copyright (C) 2001-2009 Artima, Inc. All rights reserved.