ScalaTest 1.0
|
|
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:
graphic
file
xml
stdout
stderr
reporterclass
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"/>
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 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
def
setRunpath(runpath : org.apache.tools.ant.types.Path) : Unit
runpath
attribute.haltonfailure
attribute.fork
attribute.
def
setMaxmemory(max : java.lang.String) : Unit
maxmemory
attribute.
def
setTestNGSuites(testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
testngsuites
attribute.
def
setConcurrent(concurrent : Boolean) : Unit
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.numthreads
attribute.parallel
attribute.
def
addConfiguredRunpath(runpath : org.apache.tools.ant.types.Path) : Unit
runpath
.
def
addConfiguredTestNGSuites(testNGSuitePath : org.apache.tools.ant.types.Path) : Unit
testngsuites
.
def
addConfiguredRunpathUrl(runpathurl : org.scalatest.tools.RunpathUrl) : Unit
runpathurl
.
def
addConfiguredJvmArg(arg : org.scalatest.tools.JvmArg) : Unit
jvmarg
.
def
addConfiguredProperty(property : org.scalatest.tools.NameValuePair) : Unit
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
config
.
def
setSuite(suite : java.lang.String) : Unit
suite
attribute.
def
setMembersonly(packageName : java.lang.String) : Unit
membersonly
attribute.
def
setWildcard(packageName : java.lang.String) : Unit
wildcard
attribute.
def
addConfiguredSuite(suite : org.scalatest.tools.SuiteElement) : Unit
suite
.
def
addConfiguredMembersOnly(membersonly : org.scalatest.tools.PackageElement) : Unit
membersonly
.
def
addConfiguredWildcard(wildcard : org.scalatest.tools.PackageElement) : Unit
wildcard
.
def
addConfiguredReporter(reporter : org.scalatest.tools.ReporterElement) : Unit
reporter
.
def
addConfiguredTagsToInclude(tagsToInclude : org.scalatest.tools.TextElement) : Unit
tagsToInclude
.
def
addConfiguredIncludes(includes : org.scalatest.tools.TextElement) : Unit
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
excludes
.
def
addConfiguredExcludes(excludes : org.scalatest.tools.TextElement) : Unit
excludes
.
The excludes
attribute has been deprecated and will be removed in a future version of ScalaTest.
Please use the tagsToExclude
attribute instead.
ScalaTest 1.0
|
|