org.scalatest.tools

ScalaTestAntTask

class ScalaTestAntTask extends Task

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, junitxml and reporterclass require additional attributes filename, directory, and classname, respectively:

  <scalatest>
    <reporter type="stdout"        config="FAB"/>
    <reporter type="file"          filename="test.out"/>
    <reporter type="junitxml"      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"/>

known subclasses: ScalaTestTask

Inherits

  1. Task
  2. ProjectComponent
  3. Cloneable
  4. AnyRef
  5. Any

Value Members

  1. def addConfiguredConfig(config: NameValuePair): Unit

    Sets values from nested element config

    Sets values from nested element config.

  2. def addConfiguredExcludes(excludes: TextElement): Unit

    Sets value from nested element excludes

    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.

  3. def addConfiguredIncludes(includes: TextElement): Unit

    Sets value from nested element includes

    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.

  4. def addConfiguredJvmArg(arg: JvmArg): Unit

    Sets value from nested element jvmarg

    Sets value from nested element jvmarg.

  5. def addConfiguredMembersOnly(membersonly: PackageElement): Unit

    Sets value from nested element membersonly

    Sets value from nested element membersonly.

  6. def addConfiguredProperty(property: NameValuePair): Unit

    Sets values from nested element property

    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.

  7. def addConfiguredReporter(reporter: ReporterElement): Unit

    Sets value from nested element reporter

    Sets value from nested element reporter.

  8. def addConfiguredRunpath(runpath: Path): Unit

    Sets value from nested element runpath

    Sets value from nested element runpath.

  9. def addConfiguredRunpathUrl(runpathurl: RunpathUrl): Unit

    Sets value from nested element runpathurl

    Sets value from nested element runpathurl.

  10. def addConfiguredSuite(suite: SuiteElement): Unit

    Sets value from nested element suite

    Sets value from nested element suite.

  11. def addConfiguredTagsToExclude(tagsToExclude: TextElement): Unit

    Sets value from nested element excludes

    Sets value from nested element excludes.

  12. def addConfiguredTagsToInclude(tagsToInclude: TextElement): Unit

    Sets value from nested element tagsToInclude

    Sets value from nested element tagsToInclude.

  13. def addConfiguredTestNGSuites(testNGSuitePath: Path): Unit

    Sets value from nested element testngsuites

    Sets value from nested element testngsuites.

  14. def addConfiguredWildcard(wildcard: PackageElement): Unit

    Sets value from nested element wildcard

    Sets value from nested element wildcard.

  15. def clone(): AnyRef

    This method creates and returns a copy of the receiver object

    This method creates and returns a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    definition classes: ProjectComponent ⇐ AnyRef
  16. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  17. def execute(): Unit

    Executes the task

    Executes the task.

  18. def getDescription(): String

  19. def getLocation(): Location

  20. def getOwningTarget(): Target

  21. def getProject(): Project

  22. def getRuntimeConfigurableWrapper(): RuntimeConfigurable

  23. def getTaskName(): String

  24. def getTaskType(): String

  25. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  26. def init(): Unit

  27. def log(arg0: String, arg1: Throwable, arg2: Int): Unit

  28. def log(arg0: Throwable, arg1: Int): Unit

  29. def log(arg0: String, arg1: Int): Unit

  30. def log(arg0: String): Unit

  31. def maybeConfigure(): Unit

  32. def reconfigure(): Unit

  33. def setConcurrent(concurrent: Boolean): Unit

    Sets value of the concurrent attribute

    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.

  34. def setDescription(arg0: String): Unit

  35. def setFork(fork: Boolean): Unit

    Sets value of the fork attribute

    Sets value of the fork attribute.

  36. def setHaltonfailure(haltonfailure: Boolean): Unit

    Sets value of the haltonfailure attribute

    Sets value of the haltonfailure attribute.

  37. def setLocation(arg0: Location): Unit

  38. def setMaxmemory(max: String): Unit

    Sets value of the maxmemory attribute

    Sets value of the maxmemory attribute.

  39. def setMembersonly(packageName: String): Unit

    Sets value of membersonly attribute

    Sets value of membersonly attribute.

  40. def setNumthreads(numthreads: Int): Unit

    Sets value of the numthreads attribute

    Sets value of the numthreads attribute.

  41. def setOwningTarget(arg0: Target): Unit

  42. def setParallel(parallel: Boolean): Unit

    Sets value of the parallel attribute

    Sets value of the parallel attribute.

  43. def setProject(arg0: Project): Unit

  44. def setRunpath(runpath: Path): Unit

    Sets value of the runpath attribute

    Sets value of the runpath attribute.

  45. def setRuntimeConfigurableWrapper(arg0: RuntimeConfigurable): Unit

  46. def setSuite(suite: String): Unit

    Sets value of suite attribute

    Sets value of suite attribute.

  47. def setTaskName(arg0: String): Unit

  48. def setTaskType(arg0: String): Unit

  49. def setTestNGSuites(testNGSuitePath: Path): Unit

    Sets value of the testngsuites attribute

    Sets value of the testngsuites attribute.

  50. def setWildcard(packageName: String): Unit

    Sets value of wildcard attribute

    Sets value of wildcard attribute.

  51. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: AnyRef ⇐ Any

Instance constructors

  1. new ScalaTestAntTask()