package core
- Alphabetic
- Public
- Protected
Type Members
- trait AsExecution[T] extends AnyRef
- case class Backtab(n: Int = 1) extends Description with Product with Serializable
The next fragment must be un-indented
- case class Code(text: String) extends Description with Product with Serializable
- trait ContextualSpecificationStructure extends AnyRef
- Annotations
- @EnableReflectiveInstantiation()
- trait Description extends AnyRef
Description of a Fragment
- case class Env(arguments: Arguments, systemLogger: Logger, selectorInstance: (Arguments) => Selector, executorInstance: (Arguments) => Executor, lineLogger: LineLogger, statsRepository: (Arguments) => StatisticsRepository, random: Random, fileSystem: FileSystem, executionParameters: ExecutionParameters, customClassLoader: Option[ClassLoader], classLoading: ClassLoading, executionEnv: ExecutionEnv, specs2ExecutionEnv: ExecutionEnv) extends Product with Serializable
Whole creation / execution / reporting environment for a specification
Whole creation / execution / reporting environment for a specification
Part of it is driven by the command-line, part of it is specs2 implementation Yet it can be used to drive the creation or execution of examples
Note: creating an Env instance is a delicate activity because the Env hold a thread pool that needs to be shutdown at the end of the execution
- case class ExecutedResult(result: Result, timer: SimpleTimer) extends Product with Serializable
- trait Executing extends AnyRef
- case class Execution(run: Option[(Env) => Future[() => Result]] = None, executing: Executing = NotExecuting, timeout: Option[FiniteDuration] = None, mustJoin: Boolean = false, nextMustStopIf: (Result) => Boolean = (r: Result) => false, isolable: Boolean = true, previousResult: Option[Result] = None, continuation: Option[FragmentsContinuation] = None) extends Product with Serializable
Execution of a Fragment
Execution of a Fragment
- there can be none (for a piece of text)
- the execution depends on the current Env. by default executions are created synchronously but can also be fork-off with Execution.withEnvAsync
- it can have its own timeout (default is infinite)
- once executed the result is kept
- if mustJoin is true this means that all previous executions must be finished before this one can start
- it has a condition deciding if the next execution can proceed or not depending on the current result
- if isolable is true this means that it should be executed in its own specification instance
- the result of a similar execution can be stored to decide if this one needs to be executed or not
- it can store a continuation that will create more fragments, possibly containing more executions, based on the current result
- case class ExecutionParameters(timeout: Option[FiniteDuration] = None, withIsolation: Boolean = true) extends Product with Serializable
- case class Failed(failure: Throwable) extends Executing with Product with Serializable
- case class FatalExecution(t: Throwable) extends Exception with Product with Serializable
- case class Fragment(description: Description, execution: Execution, location: Location = StacktraceLocation()) extends Product with Serializable
Fragment of a specification
Fragment of a specification
It has a description (generally text but sometimes not, for a step for example) It has an execution which might do or don't do anything (for examples it runs some code)
- case class Fragments(contents: AsyncStream[Fragment]) extends Product with Serializable
Fragments of a specification
Fragments of a specification
It is implemented as a Process of Fragment in order to produce fragments dynamically if necessary
- case class FragmentsContinuation(continue: (Result) => Option[Fragments]) extends Product with Serializable
Function creating more fragments (to be added to the specification) based on the current result
- trait ImmutableSpecificationStructure extends SpecificationStructure
Structure of an immutable specification.
Structure of an immutable specification.
It may depend on the current environment.
If the examples need to be executed in their own instance of the specification they will be "isolated"
- trait Location extends AnyRef
Location of a Fragment
Location of a Fragment
This is currently implemented using stacktraces which is very brittle
- case class Marker(tag: NamedTag, isSection: Boolean = false, appliesToNext: Boolean = true) extends Description with Product with Serializable
Description of a Tag fragment
- trait OwnEnv extends AfterAll
This trait copies the inherited env: Env for a Specification and makes sure it is shutdown when the specification finishes
This trait copies the inherited env: Env for a Specification and makes sure it is shutdown when the specification finishes
The specification using this trait must require an Env:
class MySpec(env: Env) extends Specification with OwnEnv
- trait OwnExecutionEnv extends AfterAll
This trait provides an isolated Execution Env for a Specification and makes sure it is shutdown when the specification finishes.
This trait provides an isolated Execution Env for a Specification and makes sure it is shutdown when the specification finishes.
The specification using this trait must require an Env:
class MySpec(env: Env) extends Specification with OwnExecutionEnv
- case class SimpleLocation(trace: TraceLocation) extends Location with Product with Serializable
- case class SpecHeader(specClass: Class[_], title: Option[String] = None) extends Product with Serializable
Header of a Specification
Header of a Specification
It can hold a user-defined title for better presentation
- case class SpecStructure(header: SpecHeader, arguments: Arguments, lazyFragments: () => Fragments) extends Product with Serializable
Structure of a Specification:
Structure of a Specification:
- a header
- some arguments
- specification fragments
Note that the fragments have to be lazy in order to avoid cycles when 2 specifications are referencing each other with links
- case class SpecificationRef(header: SpecHeader, arguments: Arguments, alias: String = "", tooltip: String = "", hidden: Boolean = false, muted: Boolean = false) extends Description with Product with Serializable
Reference to another specification
- trait SpecificationStructure extends ContextualSpecificationStructure
- case class StacktraceLocation(trace: Seq[StackTraceElement] = new Exception).getStackTrace) extends Location with Product with Serializable
- case class Started(future: Future[(Result, SimpleTimer)]) extends Executing with Product with Serializable
- case class Tab(n: Int = 1) extends Description with Product with Serializable
The next fragment must be indented
- case class Text(text: String) extends Description with Product with Serializable
Text description
Value Members
- object AsExecution
- case object Br extends Description with Product with Serializable
Break (== new line)
- object Description
Creation methods for Descriptions
- case object End extends Description with Product with Serializable
End of a block
- object Env extends Serializable
- object EnvDefault
- object Execution extends Serializable
- object FatalExecution extends Serializable
- object Fragment extends Serializable
- object Fragments extends Serializable
- object FragmentsContinuation extends Serializable
- case object NoText extends Description with Product with Serializable
NoText description, used when creating steps and actions which are not described
- case object NotExecuting extends Executing with Product with Serializable
- object SpecHeader extends Serializable
- object SpecStructure extends Serializable
Create SpecStructures from header, arguments, fragments
- object SpecificationRef extends Serializable
- object SpecificationStructure
- case object Start extends Description with Product with Serializable
Start of a block.
Start of a block. This is used to delimit the blocks in mutable specifications and know exactly how to create levels when transforming a specification to a tree of examples (for JUnit for example)