trait TestData extends AnyRef
A bundle of information about the current test.
A TestData
object is passed to the withFixture
methods of traits Suite
and fixture.Suite
(both NoArgTest
and OneArgTest
extend TestData
) and to the beforeEach
and afterEach
methods of trait BeforeAndAfterEach
. This enables fixtures and tests to make use
of the test name and configuration objects in the config map.
In ScalaTest's event model, a test may be surrounded by “scopes.” Each test and scope is associated with string of text. A test's name is a concatenation of the text of any surrounding scopes followed by the text provided with the test itself, after each text element has been trimmed and one space inserted between each component. Here's an example:
package org.scalatest.examples.freespec import org.scalatest.FreeSpec class SetSpec extends FreeSpec { "A Set" - { "when empty" - { "should have size 0" in { assert(Set.empty.size === 0) } "should produce NoSuchElementException when head is invoked" in { assertThrows[NoSuchElementException] { Set.empty.head } } } } }
The above FreeSpec
contains two tests, both nested inside the same two scopes. The outermost scope names
the subject, A Set
. The nested scope qualifies the subject with when empty
. Inside that
scope are the two tests. The text of the tests are:
should have size 0
should produce NoSuchElementException when head is invoked
Therefore, the names of these two tests are:
A Stack when empty should have size 0
A Stack when empty should produce NoSuchElementException when head is invoked
The TestData
instance for the first test would contain:
name
:"A Stack when empty should have size 0"
scopes
:collection.immutable.IndexedSeq("A Stack", "when empty")
text
:"should have size 0"
- Source
- TestData.scala
- Alphabetic
- By Inheritance
- TestData
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
val
configMap: ConfigMap
A
ConfigMap
containing objects that can be used to configure the fixture and test.A
ConfigMap
containing objects that can be used to configure the fixture and test. -
abstract
val
name: String
The name of this test.
The name of this test.
See the main documentation for this trait for an explanation of the difference between
name
,text
, andscopes
. - abstract val pos: Option[Position]
-
abstract
val
scopes: IndexedSeq[String]
An immutable
IndexedSeq
containing the text for any "scopes" enclosing this test, in order from outermost to innermost scope.An immutable
IndexedSeq
containing the text for any "scopes" enclosing this test, in order from outermost to innermost scope.See the main documentation for this trait for an explanation of the difference between
name
,text
, andscopes
. If a test has no surrounding scopes, this field will contain an emptyIndexedSeq
. -
abstract
val
tags: Set[String]
Tag names for this test.
-
abstract
val
text: String
The "text" for this test.
The "text" for this test.
See the main documentation for this trait for an explanation of the difference between
name
,text
, andscopes
. If a test has no surrounding scopes, this field will contain the same string asname
.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )