org.scalatest

run

object run extends AnyRef

Singleton object providing an apply method for the ScalaTest shell and a main method for ScalaTest's simple runner.

The apply method can be used in the ScalaTest Shell (its DSL for the Scala interpreter) in this way:

scala> import org.scalatest._
import org.scalatest._

scala> class ArithmeticSuite extends FunSuite with ShouldMatchers { | test("addition works") { | 1 + 1 should equal (2) | } | ignore("subtraction works") { | 1 - 1 should equal (0) | } | test("multiplication works") { | 1 * 1 should equal (2) | } | test("division works") (pending) | } defined class ArithmeticSuite

scala> run(new ArithmeticSuite) ArithmeticSuite: - addition works - subtraction works !!! IGNORED !!! - multiplication works *** FAILED *** 1 did not equal 2 (<console>:16) - division works (pending)

The last command is calling the apply method on the run singleton object. In other words, you could alternatively call it this way:

scala> run.apply(new ArithmeticSuite)
ArithmeticSuite:
- addition works
- subtraction works !!! IGNORED !!!
- multiplication works *** FAILED ***
  1 did not equal 2 (<console>:16)
- division works (pending)

The run singleton object also serves a different purpose. Its main method allows users to "run" run as a Scala application. ScalaTest's Runner application is very powerful, but doesn't provide the simplest out-of-box experience for people trying ScalaTest for the first time. For example, to run an ExampleSpec in the unnamed package from the directory where it is compiled with Runner's standard out reporter requires this command:

$ scala -cp scalatest-RELEASE.jar org.scalatest.tools.Runner -R . -o -s ExampleSpec

Running it with the run application is simpler:

$ scala -cp scalatest-RELEASE.jar org.scalatest.run ExampleSpec

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. run
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

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 apply (suite: Suite, testName: String = null, configMap: Map[String, Any] = Map()): Unit

    Run the passed suite, optionally passing in a test name and config map.

    Run the passed suite, optionally passing in a test name and config map.

    This method will invoke execute on the passed suite, passing in the specified (or default) testName and configMap and the configuration values passed to this Shell's constructor (colorPassed, durationsPassed, shortStacksPassed, fullStacksPassed, and statsPassed).

  7. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  8. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def eq (arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  11. def finalize (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
  13. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def main (args: Array[String]): Unit

    Run the suites whose fully qualified names are passed as arguments.

    Run the suites whose fully qualified names are passed as arguments.

    This method will invoke the main method of org.scalatest.tools.Runner, passing in "-R ." to set the runpath to the current directory, "-o" to select the standard out reporter, and each argument preceded by -s. For example, this run command:

    $ scala -cp scalatest-RELEASE.jar org.scalatest.run ExampleSpec
    

    Has the same effect as this Runner command:

    $ scala -cp scalatest-RELEASE.jar org.scalatest.tools.Runner -R . -o -s ExampleSpec
    

    args

  16. def ne (arg0: AnyRef): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  19. def synchronized [T0] (arg0: ⇒ T0): T0

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

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any