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, html, and reporterclass require additional attributes (the css attribute is optional for the html reporter):

  <scalatest>
    <reporter type="stdout" config="FAB"/>
    <reporter type="file" filename="test.out"/>
    <reporter type="junitxml" directory="target"/>
    <reporter type="html" directory="target" css="src/main/html/mystylesheet.css"/>
    <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 suffixes="[pipe-delimited list of suffixes]" to specify that only classes whose names end in one of the specified suffixes should be included in discovery searches for Suites to test. This can be used to improve discovery time or to limit the scope of a test. E.g.:

  <scalatest suffixes="Spec|Suite">

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 sortSuites attribute to request that events be sorted on-the-fly so that events for the same suite are reported together, with a timeout, (e.g., sortSuites="true"), and 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"/>

Linear Supertypes
Task, ProjectComponent, Cloneable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. ScalaTestAntTask
  2. Task
  3. ProjectComponent
  4. Cloneable
  5. AnyRef
  6. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ScalaTestAntTask ()

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def addConfiguredConfig (config: NameValuePair): Unit

    Sets values from nested element config.

  7. def addConfiguredJvmArg (arg: JvmArg): Unit

    Sets value from nested element jvmarg.

  8. def addConfiguredMembersOnly (membersonly: PackageElement): Unit

    Sets value from nested element membersonly.

  9. def addConfiguredReporter (reporter: ReporterElement): Unit

    Sets value from nested element reporter.

  10. def addConfiguredRunpath (runpath: Path): Unit

    Sets value from nested element runpath.

  11. def addConfiguredRunpathUrl (runpathurl: RunpathUrl): Unit

    Sets value from nested element runpathurl.

  12. def addConfiguredStyle (style: StyleElement): Unit

  13. def addConfiguredSuite (suite: SuiteElement): Unit

    Sets value from nested element suite.

  14. def addConfiguredTagsToExclude (tagsToExclude: TextElement): Unit

    Sets value from nested element excludes.

  15. def addConfiguredTagsToInclude (tagsToInclude: TextElement): Unit

    Sets value from nested element tagsToInclude.

  16. def addConfiguredTestNGSuites (testNGSuitePath: Path): Unit

    Sets value from nested element testngsuites.

  17. def addConfiguredWildcard (wildcard: PackageElement): Unit

    Sets value from nested element wildcard.

  18. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  19. def bindToOwner (arg0: Task): Unit

    Attributes
    final
    Definition Classes
    Task
  20. def clone (): AnyRef

    Definition Classes
    ProjectComponent → AnyRef
    Annotations
    @throws()
  21. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  22. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  23. def execute (): Unit

    Executes the task.

    Executes the task.

    Definition Classes
    ScalaTestAntTask → Task
  24. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  26. def getDescription (): String

    Definition Classes
    ProjectComponent
  27. def getLocation (): Location

    Definition Classes
    ProjectComponent
  28. def getOwningTarget (): Target

    Definition Classes
    Task
  29. def getProject (): Project

    Definition Classes
    ProjectComponent
  30. def getRuntimeConfigurableWrapper (): RuntimeConfigurable

    Definition Classes
    Task
  31. def getTaskName (): String

    Definition Classes
    Task
  32. def getTaskType (): String

    Definition Classes
    Task
  33. def getWrapper (): RuntimeConfigurable

    Attributes
    protected[ant]
    Definition Classes
    Task
  34. def handleErrorFlush (arg0: String): Unit

    Attributes
    protected[ant]
    Definition Classes
    Task
  35. def handleErrorOutput (arg0: String): Unit

    Attributes
    protected[ant]
    Definition Classes
    Task
  36. def handleFlush (arg0: String): Unit

    Attributes
    protected[ant]
    Definition Classes
    Task
  37. def handleInput (arg0: Array[Byte], arg1: Int, arg2: Int): Int

    Attributes
    protected[ant]
    Definition Classes
    Task
    Annotations
    @throws()
  38. def handleOutput (arg0: String): Unit

    Attributes
    protected[ant]
    Definition Classes
    Task
  39. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  40. def init (): Unit

    Definition Classes
    Task
    Annotations
    @throws()
  41. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  42. def isInvalid (): Boolean

    Attributes
    protected[ant] final
    Definition Classes
    Task
  43. def log (arg0: String, arg1: Throwable, arg2: Int): Unit

    Definition Classes
    Task
  44. def log (arg0: Throwable, arg1: Int): Unit

    Definition Classes
    Task
  45. def log (arg0: String, arg1: Int): Unit

    Definition Classes
    Task → ProjectComponent
  46. def log (arg0: String): Unit

    Definition Classes
    Task → ProjectComponent
  47. def maybeConfigure (): Unit

    Definition Classes
    Task
    Annotations
    @throws()
  48. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  49. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  50. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  51. def perform (): Unit

    Attributes
    final
    Definition Classes
    Task
  52. def reconfigure (): Unit

    Definition Classes
    Task
  53. def setDescription (arg0: String): Unit

    Definition Classes
    ProjectComponent
  54. def setFork (fork: Boolean): Unit

    Sets value of the fork attribute.

  55. def setHaltonfailure (haltonfailure: Boolean): Unit

    Sets value of the haltonfailure attribute.

  56. def setLocation (arg0: Location): Unit

    Definition Classes
    ProjectComponent
  57. def setMaxmemory (max: String): Unit

    Sets value of the maxmemory attribute.

  58. def setMembersonly (packageName: String): Unit

    Sets value of membersonly attribute.

  59. def setNumthreads (numthreads: Int): Unit

    Sets value of the numthreads attribute.

  60. def setOwningTarget (arg0: Target): Unit

    Definition Classes
    Task
  61. def setParallel (parallel: Boolean): Unit

    Sets value of the parallel attribute.

  62. def setProject (arg0: Project): Unit

    Definition Classes
    ProjectComponent
  63. def setRunpath (runpath: Path): Unit

    Sets value of the runpath attribute.

  64. def setRuntimeConfigurableWrapper (arg0: RuntimeConfigurable): Unit

    Definition Classes
    Task
  65. def setSortSuites (sortSuites: Boolean): Unit

    Sets value of the sortSuites attribute.

  66. def setSpanScaleFactor (spanScaleFactor: Double): Unit

    Sets value of the spanScaleFactor attribute.

  67. def setStyle (style: String): Unit

    Sets value of style attribute.

  68. def setSuffixes (suffixes: String): Unit

    Sets value of the suffixes attribute.

  69. def setSuite (suite: SuiteElement): Unit

    Sets value of suite attribute.

  70. def setTaskName (arg0: String): Unit

    Definition Classes
    Task
  71. def setTaskType (arg0: String): Unit

    Definition Classes
    Task
  72. def setTestNGSuites (testNGSuitePath: Path): Unit

    Sets value of the testngsuites attribute.

  73. def setWildcard (packageName: String): Unit

    Sets value of wildcard attribute.

  74. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  75. def toString (): String

    Definition Classes
    AnyRef → Any
  76. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  77. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  78. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  79. 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.

    Annotations
    @deprecated
    Deprecated

    Please use tagsToExclude instead

  80. 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.

    Annotations
    @deprecated
    Deprecated

    Please use tagsToInclude instead

  81. 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.

    Annotations
    @deprecated
    Deprecated

    Please use config instead

  82. 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.

    Annotations
    @deprecated
    Deprecated

    Please use parallel instead

Inherited from Task

Inherited from ProjectComponent

Inherited from Cloneable

Inherited from AnyRef

Inherited from Any