Class

org.scalatest.tools

ScalaTestAntTask

Related Doc: package tools

Permalink

class ScalaTestAntTask extends Task

An ant task to run ScalaTest. Instructions on how to specify various options are below. See the main documentation for object 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"/>
   <-- scala-actors.jar needed only for ScalaTest <= 1.9.1 on Scala >= 2.10.0 -->
   <pathelement location="${lib}/scala-actors.jar"/>
 </path>

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

   <scalatest ...
 </target>

Note that you only need the scala-actors.jar if you are using ScalaTest version 1.9.1 or earlier with Scala 2.10 or later. Once defined, you use the task by specifying information in a scalatest element:

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

You can place key value pairs into the config map 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, memory, junitxml, html, and reporterclass require additional attributes (the css attribute is optional for the html reporter):

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

Tags to include or exclude can also be specified using attributes tagsToInclude and tagsToExclude, with arguments specified as whitespace- delimited lists.

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 tests to run, use nested <test> elements with either a 'name' or 'substring' attribute:

  <scalatest>
    <test name="hello test"/>
    <test substring="hello"/>

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 testsfile="[file name]" or nested <testsfile> elements to specify files containing a list of tests to be run. This is used to rerun failed/canceled tests listed in files written by the memory reporter. E.g.:

  <scalatest testsfile="target/memory.out">

or

  <scalatest>
    <testsfile filename="target/memory.out"/>

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"/>

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

Instance Constructors

  1. new ScalaTestAntTask()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addConfiguredConfig(config: NameValuePair): Unit

    Permalink

    Sets values from nested element config.

    Sets values from nested element config.

  5. def addConfiguredJvmArg(arg: JvmArg): Unit

    Permalink

    Sets value from nested element jvmarg.

    Sets value from nested element jvmarg.

  6. def addConfiguredMembersOnly(membersonly: PackageElement): Unit

    Permalink

    Sets value from nested element membersonly.

    Sets value from nested element membersonly.

  7. def addConfiguredReporter(reporter: ReporterElement): Unit

    Permalink

    Sets value from nested element reporter.

    Sets value from nested element reporter.

  8. def addConfiguredRunpath(runpath: Path): Unit

    Permalink

    Sets value from nested element runpath.

    Sets value from nested element runpath.

  9. def addConfiguredRunpathUrl(runpathurl: RunpathUrl): Unit

    Permalink

    Sets value from nested element runpathurl.

    Sets value from nested element runpathurl.

  10. def addConfiguredStyle(style: StyleElement): Unit

    Permalink
  11. def addConfiguredSuite(suite: SuiteElement): Unit

    Permalink

    Sets value from nested element suite.

    Sets value from nested element suite.

  12. def addConfiguredTagsToExclude(tagsToExclude: TextElement): Unit

    Permalink

    Sets value from nested element tagsToExclude.

    Sets value from nested element tagsToExclude.

  13. def addConfiguredTagsToInclude(tagsToInclude: TextElement): Unit

    Permalink

    Sets value from nested element tagsToInclude.

    Sets value from nested element tagsToInclude.

  14. def addConfiguredTest(test: TestElement): Unit

    Permalink

    Sets value from nested element test.

    Sets value from nested element test.

  15. def addConfiguredTestNGSuites(testNGSuitePath: Path): Unit

    Permalink

    Sets value from nested element testngsuites.

    Sets value from nested element testngsuites.

  16. def addConfiguredTestsfile(testsfile: TestsfileElement): Unit

    Permalink

    Sets value from nested element testsfile.

    Sets value from nested element testsfile.

  17. def addConfiguredWildcard(wildcard: PackageElement): Unit

    Permalink

    Sets value from nested element wildcard.

    Sets value from nested element wildcard.

  18. final def asInstanceOf[T0]: T0

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

    Permalink
    Definition Classes
    Task
  20. def buildArgsList: List[String]

    Permalink
  21. def clone(): AnyRef

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

    Permalink
    Definition Classes
    AnyRef
  23. def equals(arg0: Any): Boolean

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

    Permalink

    Executes the task.

    Executes the task.

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def getDescription(): String

    Permalink
    Definition Classes
    ProjectComponent
  28. def getLocation(): Location

    Permalink
    Definition Classes
    ProjectComponent
  29. def getOwningTarget(): Target

    Permalink
    Definition Classes
    Task
  30. def getProject(): Project

    Permalink
    Definition Classes
    ProjectComponent
  31. def getRuntimeConfigurableWrapper(): RuntimeConfigurable

    Permalink
    Definition Classes
    Task
  32. def getTaskName(): String

    Permalink
    Definition Classes
    Task
  33. def getTaskType(): String

    Permalink
    Definition Classes
    Task
  34. def getWrapper(): RuntimeConfigurable

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  35. def handleErrorFlush(arg0: String): Unit

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  36. def handleErrorOutput(arg0: String): Unit

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  37. def handleFlush(arg0: String): Unit

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  38. def handleInput(arg0: Array[Byte], arg1: Int, arg2: Int): Int

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
    Annotations
    @throws( classOf[java.io.IOException] )
  39. def handleOutput(arg0: String): Unit

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  40. def hashCode(): Int

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

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

    Permalink
    Definition Classes
    Any
  43. final def isInvalid(): Boolean

    Permalink
    Attributes
    protected[org.apache.tools.ant]
    Definition Classes
    Task
  44. def log(arg0: String, arg1: Throwable, arg2: Int): Unit

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

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

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

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

    Permalink
    Definition Classes
    Task
    Annotations
    @throws( ... )
  49. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  50. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  51. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  52. final def perform(): Unit

    Permalink
    Definition Classes
    Task
  53. def reconfigure(): Unit

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

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

    Permalink

    Sets value of the fork attribute.

    Sets value of the fork attribute.

  56. def setHaltonfailure(haltonfailure: Boolean): Unit

    Permalink

    Sets value of the haltonfailure attribute.

    Sets value of the haltonfailure attribute.

  57. def setLocation(arg0: Location): Unit

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

    Permalink

    Sets value of the maxmemory attribute.

    Sets value of the maxmemory attribute.

  59. def setMembersonly(packageName: String): Unit

    Permalink

    Sets value of membersonly attribute.

    Sets value of membersonly attribute.

  60. def setNumthreads(numthreads: Int): Unit

    Permalink

    Sets value of the numthreads attribute.

    Sets value of the numthreads attribute.

  61. def setOwningTarget(arg0: Target): Unit

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

    Permalink

    Sets value of the parallel attribute.

    Sets value of the parallel attribute.

  63. def setProject(arg0: Project): Unit

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

    Permalink

    Sets value of the runpath attribute.

    Sets value of the runpath attribute.

  65. def setRuntimeConfigurableWrapper(arg0: RuntimeConfigurable): Unit

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

    Permalink

    Sets value of the sortSuites attribute.

    Sets value of the sortSuites attribute.

  67. def setSpanScaleFactor(spanScaleFactor: Double): Unit

    Permalink

    Sets value of the spanScaleFactor attribute.

    Sets value of the spanScaleFactor attribute.

  68. def setStyle(style: String): Unit

    Permalink

    Sets value of style attribute.

    Sets value of style attribute.

  69. def setSuffixes(suffixes: String): Unit

    Permalink

    Sets value of the suffixes attribute.

    Sets value of the suffixes attribute.

  70. def setSuite(suite: SuiteElement): Unit

    Permalink

    Sets value of suite attribute.

    Sets value of suite attribute.

  71. def setTagsToExclude(tagsToExclude: String): Unit

    Permalink

    Sets value of the tagsToExclude attribute.

    Sets value of the tagsToExclude attribute.

  72. def setTagsToInclude(tagsToInclude: String): Unit

    Permalink

    Sets value of the tagsToInclude attribute.

    Sets value of the tagsToInclude attribute.

  73. def setTaskName(arg0: String): Unit

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

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

    Permalink

    Sets value of the testngsuites attribute.

    Sets value of the testngsuites attribute.

  76. def setTestsfile(testsfile: String): Unit

    Permalink

    Sets value of the testsfile attribute.

    Sets value of the testsfile attribute.

  77. def setWildcard(packageName: String): Unit

    Permalink

    Sets value of wildcard attribute.

    Sets value of wildcard attribute.

  78. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  79. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  80. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Task

Inherited from ProjectComponent

Inherited from Cloneable

Inherited from AnyRef

Inherited from Any

Ungrouped