org.specs.specification.Example

class Example

case class Example(val description : String, val cycle : ExampleLifeCycle)

 extends Product


The Example class specifies one example of a system behaviour
It has:

Usage: "this is an example" in { // code containing assertions } or
"this is an example" >> { // code containing assertions }
">>" can be used instead of "in" if that word makes no sense in the specification

An example can also contain subexamples which are executed will evaluating the in method.

When assertions have been evaluated inside an example they register their failures and errors for later reporting



Companion: Example

Source: Example.scala(28)

 Constructors

def this(description : String, cycle : ExampleLifeCycle)

 Fields

addAssertion def addAssertion
increment the number of assertions in this example
Example
assertionsNb def assertionsNb
[details]
return
- the number of assertions, executing the example if necessary
Int
errors def errors
[details]
return
- the errors of this example and its subexamples, executing the example if necessary
Seq[Throwable]
failures def failures
[details]
return
- the failures of this example and its subexamples, executing the example if necessary
Seq[FailureException]
productArity override def productArity Int
productPrefix override def productPrefix String
skipped def skipped
[details]
return
- the skipped messages for this example and its subexamples, executing the example if necessary
Seq[SkippedException]
subExamples def subExamples
[details]
return
- the subexamples, executing the example if necessary
Queue[Example]
thisErrors var thisErrors
errors created by Assert objects inside the in method
Queue[Throwable]
thisFailures var thisFailures
failures created by Assert objects inside the in method
Queue[FailureException]
thisSkipped var thisSkipped
skipped created by Assert objects inside the in method
Queue[SkippedException]

 Methods

!= final def !=(arg0 : Any) Boolean Any
!= final def !=(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Any) Boolean Any
>> def >>(test : => Any)
alias for the in method
Example
addError def addError(t : Throwable)
creates and adds a new error from an exception t
Unit
addExample def addExample(e : Example)
add a new sub-example to this example
Unit
addFailure def addFailure(failure : FailureException)
creates and adds a failure exception
Unit
addSkipped def addSkipped(skip : SkippedException)
creates and adds a skipped exception
Unit
asInstanceOf final def asInstanceOf[T0] T0 Any
clone protected def clone Object AnyRef
eq final def eq(arg0 : Object) Boolean AnyRef
equals override def equals(arg0 : Any) Boolean
finalize protected def finalize Unit AnyRef
getClass final def getClass Class[Object] AnyRef
hashCode override def hashCode Int
in def in(test : => Any)
creates a new Example object and store as a function the test to be executed [details]
This test is a value which may contain assertions. Upon execution, errors and failures will be attached to the current example by calling the addFailure and addError methods Execution will be triggered when requesting status information on that example: failures, errors, assertions number, subexamples
return
- a new Example
Example
isInstanceOf final def isInstanceOf[T0] Boolean Any
ne final def ne(arg0 : Object) Boolean AnyRef
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
pretty def pretty(tab : String)
[details]
return
- a user message with failures and messages, spaced with a specific tab string (used in ConsoleReport)
String
productElement override def productElement(arg0 : Int) Any
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toString override def toString
[details]
return
- the example description
String
wait final def wait(arg0 : Long) Unit AnyRef
wait final def wait Unit AnyRef
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
Copyright (c) 2007-2008. All Rights Reserved.