Package

org.specs2

specification

Permalink

package specification

Visibility
  1. Public
  2. All

Type Members

  1. case class AcceptanceCreationPath(path: Seq[Int]) extends CreationPath with Product with Serializable

    Permalink
  2. case class Action(action: LazyParameter[Result] = lazyParameter(Success()), location: Location = new Location, isolable: Boolean = true, creationPath: Option[CreationPath] = None) extends Fragment with Executable with Isolable with Product with Serializable

    Permalink

    An Action is similar to a Step but can be executed concurrently with other examples.

    An Action is similar to a Step but can be executed concurrently with other examples.

    It is only reported in case of a failure

  3. trait After extends Context

    Permalink

    The After trait can be inherited by classes representing a context where an action must be executing after the main executable action

    The After trait can be inherited by classes representing a context where an action must be executing after the main executable action

    See also

    Example to understand why the type T must : AsResult

  4. trait AfterContextExample[C <: After] extends ExamplesFactory

    Permalink

    For each created example use a given After context

  5. trait AfterEach extends After with Apply

    Permalink

    apply an After context to each Example

  6. trait AfterExample extends AfterContextExample[After]

    Permalink

    For each created example use a given after method

  7. trait AllExpectations extends StoredExpectations with ExamplesFactory with SpecificationStructure with ArgumentsArgs

    Permalink

    This trait can be mixed-in a specification to allow examples to have all of their expectations being evaluated (unless the example body throws an exception of course).

    This trait can be mixed-in a specification to allow examples to have all of their expectations being evaluated (unless the example body throws an exception of course).

    All the results are collected into a list, provided by the StoredExpectations trait. These results form then the body of the each example (decorated by a special ExampleFactory) so that each example returns a Result which is the summary of all the individual issues.

    It must be noted that this trait relies on a mutable list to collect the results as they are created in the example body. Because of this restriction, a Specification using that trait can either run sequentially or isolated.

    If the specification is neither sequential or isolated, we force it to be isolated by default.

  8. trait Apply extends Context

    Permalink

    Apply a Context to a sequence of fragments containing examples.

    Apply a Context to a sequence of fragments containing examples.

    The context is then applied to each example

  9. trait Around extends Context

    Permalink

    The Around trait can be inherited by classes which will execute some code inside the around method provided by the context.

    The Around trait can be inherited by classes which will execute some code inside the around method provided by the context.

    This can be used for example to execute some code inside a webapp session

    See also

    Example to understand why the type T must : AsResult

  10. trait AroundContextExample[C <: Around] extends ExamplesFactory

    Permalink

    For each created example use a given Around context

  11. trait AroundEach extends Around with Apply

    Permalink

    apply an Around context to each Example

  12. trait AroundExample extends AroundContextExample[Around]

    Permalink

    For each created example use a given around method

  13. trait AroundOutside[+T] extends Around with Outside[T]

    Permalink

    The AroundOutside trait can be inherited by classes which will execute some code inside a given context, with a function using that context and actions before and after if necessary.

    The AroundOutside trait can be inherited by classes which will execute some code inside a given context, with a function using that context and actions before and after if necessary.

    See also

    Example to understand why the type T must : AsResult

  14. trait BaseSpecification extends SpecificationStructure with FragmentsBuilder with SpecificationInclusion

    Permalink

    A Base specification contains the minimum elements for a Specification

    A Base specification contains the minimum elements for a Specification

    - a Seq of Fragments, available through the SpecificationStructure trait - methods for creating Fragments from the FragmentsBuilder trait - methods to include other specifications

  15. trait Before extends Context

    Permalink

    The Before trait can be inherited by classes representing a context where an action must be executing before the main executable action

    The Before trait can be inherited by classes representing a context where an action must be executing before the main executable action

    See also

    Example to understand why the type T must : AsResult

  16. trait BeforeAfter extends Before with After

    Permalink

    The BeforeAfter trait allows to declare before and after actions to execute before and after an Example

    The BeforeAfter trait allows to declare before and after actions to execute before and after an Example

    See also

    After

    Before

  17. trait BeforeAfterAround extends Before with After with Around

    Permalink

    The BeforeAfterAround trait allows to declare before, around and after actions

    The BeforeAfterAround trait allows to declare before, around and after actions

    See also

    Around

    After

    Before

  18. trait BeforeAfterAroundContextExample[C <: BeforeAfterAround] extends ExamplesFactory

    Permalink

    For each created example use a given BeforeAfterAround context

  19. trait BeforeAfterAroundEach extends BeforeAfterAround with Apply

    Permalink

    apply a BeforeAfterAround context to each Example

  20. trait BeforeAfterAroundExample extends BeforeAfterAroundContextExample[BeforeAfterAround]

    Permalink

    For each created example use a given before/after method

  21. trait BeforeAfterContextExample[C <: BeforeAfter] extends ExamplesFactory

    Permalink

    For each created example use a given BeforeAfter context

  22. trait BeforeAfterEach extends BeforeAfter with Apply

    Permalink

    apply a BeforeAfter context to each Example

  23. trait BeforeAfterExample extends BeforeAfterContextExample[BeforeAfter]

    Permalink

    For each created example use a given before/after method

  24. trait BeforeContextExample[C <: Before] extends ExamplesFactory

    Permalink

    For each created example use a given Before context

  25. trait BeforeEach extends Before with Apply

    Permalink

    apply a Before context to each Example

  26. trait BeforeExample extends BeforeContextExample[Before]

    Permalink

    For each created example use a given after method

  27. trait Context extends AnyRef

    Permalink

    generic trait for Before, After, Around

  28. trait Contexts extends AnyRef

    Permalink

    This trait is only used when we wish to write after actions in unit specifications like this

    This trait is only used when we wish to write after actions in unit specifications like this

    "an example" ! { 1 must_== 1 }.after(clean)

  29. trait ContextsInjection extends Contexts

    Permalink
  30. sealed trait CreationPath extends AnyRef

    Permalink
  31. class DecoratedExampleFactory extends ExampleFactory

    Permalink

    Decorated creation where the body of the example can be surrounded with a given context if necessary

    Decorated creation where the body of the example can be surrounded with a given context if necessary

    See also

    mutable.BeforeExample

  32. class DefaultExampleFactory extends ExampleFactory

    Permalink

    Default implementation for the example factory trait just creating an Example object

  33. trait DefaultFragmentsFormatting extends FragmentsFormatting with TagsAssociation

    Permalink
  34. case class Example extends Fragment with Executable with Isolable with Product with Serializable

    Permalink

    A Example is:

    A Example is:

    - a description: some text, with possibly some markdown annotations for rendering code fragments (used in AutoExamples) - a body: some executable code returning a Result

  35. trait ExampleFactory extends AnyRef

    Permalink

    This trait defines methods for creating Examples.

    This trait defines methods for creating Examples.

    You can subclass it and implement the newExample(e: Example) method to provide alternative behavior.

    The new factory can be passed to a Specification by overriding the ExamplesFactory.exampleFactory method

  36. trait ExamplesFactory extends AnyRef

    Permalink
  37. case class ExamplesGroup(name: String = "") extends Product with Serializable

    Permalink
  38. case class ExecutedBacktab(n: Int = 1, location: Location = new Location) extends ExecutedStandardFragment with Product with Serializable

    Permalink
  39. case class ExecutedBr(location: Location = new Location) extends ExecutedStandardFragment with Product with Serializable

    Permalink
  40. case class ExecutedEnd(location: Location = new Location) extends ExecutedStandardFragment with Product with Serializable

    Permalink
  41. sealed trait ExecutedFragment extends AnyRef

    Permalink

    The Executed Fragments represent pieces of a Specification which have already been executed to provide a Result

  42. case class ExecutedNoText(original: Fragment, timer: SimpleTimer = new SimpleTimer, location: Location = new Location) extends ExecutedFragment with Product with Serializable

    Permalink

    This executed Fragment is used when no text must be displayed (for the successful execution of an Action for example)

  43. case class ExecutedResult(s: FormattedString, result: Result, timer: SimpleTimer, location: Location, statistics: Stats) extends ExecutedFragment with Product with Serializable

    Permalink
  44. case class ExecutedSpecEnd(end: SpecEnd, location: Location = new Location, stats: Stats = Stats()) extends ExecutedFragment with Product with Serializable

    Permalink
  45. case class ExecutedSpecStart(start: SpecStart, location: Location = new Location, stats: Stats = Stats().startTimer) extends ExecutedFragment with Product with Serializable

    Permalink
  46. case class ExecutedSpecification(name: SpecName, fs: Seq[ExecutedFragment]) extends Product with Serializable

    Permalink

    A specification with a name and all of its fragments already executed

  47. trait ExecutedStandardFragment extends ExecutedFragment

    Permalink
  48. case class ExecutedTab(n: Int = 1, location: Location = new Location) extends ExecutedStandardFragment with Product with Serializable

    Permalink
  49. case class ExecutedText(textFragment: Text, location: Location = new Location) extends ExecutedFragment with Product with Serializable

    Permalink
  50. sealed trait ExecutingFragment extends AnyRef

    Permalink

    The Executing Fragment trait represent a Fragment being executed.

    The Executing Fragment trait represent a Fragment being executed.

    Some fragments are executed right away, other ones on demand synchronously, and other ones concurrently

  51. case class ExecutingSpecification(name: SpecName, arguments: Arguments, fs: Seq[ExecutingFragment], executor: ExecutorService) extends Product with Serializable

    Permalink

    a specification with a name and a sequence of fragments being executed

  52. case class FinishedExecutingFragment(f: ExecutedFragment) extends ExecutingFragment with Product with Serializable

    Permalink

    embed an already executed Fragment

  53. trait Fixture[T] extends AnyRef

    Permalink

    A Fixture can be implicitly passed to a set of examples taking a function as an input.

    A Fixture can be implicitly passed to a set of examples taking a function as an input.

    It can effectively act as an Outside and an Around context

  54. trait FixtureExample[T] extends AnyRef

    Permalink

    For each created example use a given after method

  55. trait FormattedString extends AnyRef

    Permalink
  56. case class Formatting(flow: Boolean = false, markdown: Boolean = true, verbatim: Boolean = true) extends Product with Serializable

    Permalink

    Formatting for Text fragments

  57. trait FormattingFragments extends AnyRef

    Permalink

    Set of fragments which can be used for formatting

  58. trait FormattingTags extends Tags

    Permalink

  59. sealed trait Fragment extends AnyRef

    Permalink

    A Fragment is a piece of a specification.

    A Fragment is a piece of a specification. It can be a piece of text, an action or an Example

  60. trait FragmentExecution extends AnyRef

    Permalink

    This trait executes Fragments

    This trait executes Fragments

    It provides a function which executes fragments and returns executed fragments

  61. case class Fragments(specTitle: Option[SpecName] = None, middle: Seq[Fragment] = Stream().toSeq, arguments: Arguments = Arguments(), linked: Linked = Linked()) extends Product with Serializable

    Permalink

    A Fragments object is a list of fragments with a SpecStart and a SpecEnd

  62. trait FragmentsBuilder extends ExamplesFactory with ImplicitParameters with FormattingTags

    Permalink

    This trait provides function to create specification Fragments:

    This trait provides function to create specification Fragments:

    • a SpecStart fragment with title
    • a Text fragment with text
    • an Example fragment with a body
    • a group of fragments (when including another specification for example)
  63. trait FragmentsFormatting extends AnyRef

    Permalink

    This trait post-process fragments.

    This trait post-process fragments.

    The default implementation looks for tags and sections to mark text and examples as "markdown"

  64. class FragmentsFragment extends AnyRef

    Permalink

    Fragments can be chained with the ^ method

  65. trait Grouped extends GroupsLike

    Permalink

    This trait can be used to standardize names for groups of examples in an acceptance specification.

    This trait can be used to standardize names for groups of examples in an acceptance specification.

    class MySpecification extends Specification with Examples { def is = s2""" first example in first group ${g1.e1} second example in first group ${g1.e2}

    first example in second group ${g2.e1} second example in second group ${g2.e2} """ }

    trait Examples extends Grouped with Matchers { "first group of examples" - new g1 { e1 := ok e2 := ok } "second group of examples" - new g2 { e1 := ok e2 := ok } }

    If you don't want to manage groups and examples numbers it is also possible to write the following (note the script.Specification):

    class MySpecification extends script.Specification with Examples { def is = s2""" first example in first group second example in first group

    first example in second group second example in second group """ }

    trait Examples extends Grouped with Matchers { "first group of examples" - new group { eg := ok eg := ok } "second group of examples" - new group { eg := ok eg := ok } }

  66. trait Groups extends GroupsLike

    Permalink

    This trait can be used to standardize names for groups of examples in an acceptance specification.

    This trait can be used to standardize names for groups of examples in an acceptance specification.

    class MySpecification extends Specification with Examples { def is = s2""" first example in first group ${g1().e1} second example in first group ${g1().e2}

    first example in second group ${g2().e1} second example in second group ${g2().e2} """ }

    trait Examples extends Groups with Matchers { "first group of examples" - new g1 { e1 := ok e2 ;= ok } "second group of examples" - new g2 { e1 := ok e2 := ok } }

    It is important to notice that the examples must be called with g1().e1 so as to create a new g1 trait instance with new local variables for the example e1. If this is not required, the Grouped trait can be used instead

    If you don't want to manage groups and examples numbers it is also possible to write the following (note the script.Specification):

    class MySpecification extends script.Specification with Examples { def is = s2""" first example in first group second example in first group

    first example in second group second example in second group """ }

    trait Examples extends Groups with Matchers { "first group of examples" - new group { eg := ok eg := ok } "second group of examples" - new group { eg := ok eg := ok } }

  67. trait GroupsLike extends AnyRef

    Permalink
  68. abstract class HtmlLink extends AnyRef

    Permalink

    The HtmlLink class represents a link in a specification with an identifier (either a spec name, or a string) and link elements.

  69. case class LazyExecutingFragment(f: () ⇒ ExecutedFragment, original: Fragment) extends ExecutingFragment with Product with Serializable

    Permalink

    embed an executing Fragment into a function to execute it on demand

  70. case class Linked(link: Option[HtmlLink] = None, seeOnly: Boolean = false, hidden: Boolean = false) extends Product with Serializable

    Permalink

    encapsulation of the linking behaviour

  71. case class MarkdownLink(name: String, url: String) extends Product with Serializable

    Permalink

    This class provides functionalities for manipulating Markdown links

  72. case class MutableCreationPath(path: Seq[Int]) extends CreationPath with Product with Serializable

    Permalink
  73. trait NoAutoExamples extends NoBooleanAutoExamples with NoResultAutoExamples with NoMatchResultAutoExamples with NoDataTableAutoExamples

    Permalink

    This trait ca be used to deactivate all automatic conversions to examples

  74. trait NoBangExamples extends FragmentsBuilder

    Permalink

    This trait deactivates the implicit on Strings which is used to create examples with !

    This trait deactivates the implicit on Strings which is used to create examples with !

    This is useful to avoid conflict with DataTables

  75. trait NoBooleanAutoExamples extends AutoExamples

    Permalink

    This trait can be used to deactivate the Boolean conversions to fragments and examples

  76. trait NoContexts extends Contexts

    Permalink

    Use this trait to deactivate the Contexts implicits

  77. trait NoDataTableAutoExamples extends AutoExamples

    Permalink

    This trait can be used to deactivate the DataTable conversions to fragments and examples

  78. trait NoFragmentsBuilder extends FragmentsBuilder with NoToHtmlLinkFragments

    Permalink

    This trait can be used to deactivate implicits for building fragments

  79. trait NoMatchResultAutoExamples extends AutoExamples

    Permalink

    This trait can be used to deactivate the MatchResult conversions to fragments and examples

  80. trait NoResultAutoExamples extends AutoExamples

    Permalink

    This trait can be used to deactivate the Result conversions to fragments and examples

  81. trait NoToHtmlLinkFragments extends FragmentsBuilder

    Permalink

    This trait can be used to deactivate implicits for ~ and ~/ operators on strings

  82. trait Outside[+T] extends AnyRef

    Permalink

    The Outside trait can be inherited by classes which will execute some code inside the outside method provided by the context.

    The Outside trait can be inherited by classes which will execute some code inside the outside method provided by the context.

    This can be used for example to execute some code inside a webapp session, using the session object to create expectations

    See also

    Example to understand why the type T must : AsResult

  83. case class PromisedExecutingFragment(promised: Promise[ExecutedFragment], original: Fragment) extends ExecutingFragment with Product with Serializable

    Permalink

    embed an executed Fragment into a promise

  84. class ResultsContext extends StoredResultsContext

    Permalink

    This class is used to evaluate a Context as a sequence of results by side-effects.

    This class is used to evaluate a Context as a sequence of results by side-effects.

    See also

    the AllExpectations trait for its use

  85. trait Scope extends matcher.Scope

    Permalink

    Marker trait that is used to create a new scope with variables and implicitly converted to a Success in a mutable Specification

  86. case class SimpleFormattedString(t: String = "", formatting: Formatting = Formatting(), isEmpty: Boolean = false, isCode: Boolean = true) extends FormattedString with Product with Serializable

    Permalink
  87. trait Snippets extends execute.Snippets

    Permalink

    Snippets of code can be extracted from interpolated specification strings.

    Snippets of code can be extracted from interpolated specification strings.

    When you want to specify that a piece of code must be included in the specification output, you can use the snippet method to execute a this code and use the text in the output. If you just want to output part of the code you need to delimit it with some comments // 8<------- (with as many dashes as you want)

    Generally the last value of a snippet will be displayed separately but it is possible to avoid this by using the mute method on a Snippet.

    It is also possible to check that the result value is equal to a specific value by using the check[R : AsResult](f: T => R) method.

  88. case class SpecEnd(specName: SpecName, isSeeOnlyLink: Boolean = false, location: Location = new Location) extends Fragment with Product with Serializable

    Permalink

    End of a specification.

    End of a specification.

    This marks the end of the Specification and must have the same name as the corresponding SpecStart.

    There is a Boolean flag on a SpecEnd indicating if the whole specification was just executed as a link (for an index page for example) In this case we must not store statistics for this specification (see Storing.scala)

  89. case class SpecHtmlLink(name: SpecName, beforeText: String = "", linkText: String = "", afterText: String = "", tip: String = "") extends HtmlLink with Product with Serializable

    Permalink
  90. trait SpecIdentification extends AnyRef

    Permalink

    Identification information for a specification

  91. sealed trait SpecName extends SpecIdentification

    Permalink

    Name declaration for a specification

  92. trait SpecPart extends AnyRef

    Permalink
  93. case class SpecStart(specName: SpecName, arguments: Arguments = Arguments(), linked: Linked = Linked(), location: Location = new Location) extends Fragment with Product with Serializable

    Permalink

    Start of a specification.

    Start of a specification.

    This fragment keeps 2 important pieces of information:

    • the name of the specification (which is derived from the specification class or from a user-defined title) That name stores a unique id for the specification
    • the arguments for that specification
  94. trait SpecificationInclusion extends AnyRef

    Permalink

    additional methods to include other specifications or Fragments

  95. trait SpecificationNavigation extends AnyRef

    Permalink

    This trait models "what happens" before a fragment is created in terms of side-effects.

    This trait models "what happens" before a fragment is created in terms of side-effects.

    For now it is mostly used for unit specifications where side-effects can occur inside "blocks" when creating examples. We suppose that acceptance specifications do not have side-effects at creation time.

  96. trait SpecificationStringContext extends AnyRef

    Permalink

    Allow to use fragments inside interpolated strings starting with s2 in order to build the specification content

  97. trait SpecificationStructure extends DefaultFragmentsFormatting

    Permalink

    The structure of a Specification is simply defined as a sequence of fragments

  98. case class Stats(examples: Int = 0, successes: Int = 0, expectations: Int = 0, failures: Int = 0, errors: Int = 0, pending: Int = 0, skipped: Int = 0, trend: Option[Stats] = None, timer: SimpleTimer = new SimpleTimer) extends Product with Serializable

    Permalink

    The Stats class store results for the number of: - successes - expectations - failures - errors - pending - skipped

    The Stats class store results for the number of: - successes - expectations - failures - errors - pending - skipped

    for each example

  99. case class Step(step: LazyParameter[Result], stopOnFail: Boolean = false, location: Location = new Location, isolable: Boolean = true) extends Fragment with Executable with Isolable with Product with Serializable

    Permalink

    An Step creates a fragment that will either return an Error Result if there is an exception or a Success.

    An Step creates a fragment that will either return an Error Result if there is an exception or a Success.

    It is usually used to do some initialisation or cleanup before or after all the Fragments.

    Note that a Step fragment will not be reported in the output.

    See also

    the ContextSpec specification

  100. trait StoredExpectationsContext extends StoredExpectations with StoredResultsContext

    Permalink

    This trait can be used when it is not desirable to use the AllExpectations trait, that is, when the specification examples must be executed concurrently and not isolated.

    This trait can be used when it is not desirable to use the AllExpectations trait, that is, when the specification examples must be executed concurrently and not isolated.

    See also

    the UserGuide on how to use this trait

  101. trait StoredResultsContext extends Context

    Permalink

    This trait is a context which will use the results provided by the class inheriting that trait.

    This trait is a context which will use the results provided by the class inheriting that trait. It evaluates the result of an example, which is supposed to create side-effects and returns the 'storedResults' as the summary of all results

  102. trait Tables extends DataTables with NoBangExamples

    Permalink
  103. trait Tags extends AnyRef

    Permalink

    The tags trait allows the creation of Tags fragments in a Specification

  104. trait TagsAssociation extends AnyRef

    Permalink
  105. case class Text(text: SimpleFormattedString, location: Location = new Location) extends Fragment with Product with Serializable

    Permalink

    Free text, describing the system to specify

  106. case class UrlHtmlLink(url: String, beforeText: String = "", linkText: String = "", afterText: String = "", tip: String = "") extends HtmlLink with Product with Serializable

    Permalink

Value Members

  1. object Action extends Product with Serializable

    Permalink
  2. object Context

    Permalink
  3. object Contexts extends Contexts

    Permalink
  4. object DefaultFragmentsFormatting extends DefaultFragmentsFormatting

    Permalink
  5. object Example extends Product with Serializable

    Permalink
  6. object ExecutedText1

    Permalink
  7. object Fixture

    Permalink
  8. object FormattedString

    Permalink
  9. object FormattingFragments extends FormattingFragments

    Permalink
  10. object FormattingTags extends FormattingTags

    Permalink
  11. object Fragments extends Serializable

    Permalink

    Utility methods for fragments

  12. object FragmentsBuilder extends FragmentsBuilder

    Permalink
  13. object HtmlLink

    Permalink
  14. object S2Macro

    Permalink
  15. object SpecificationStructure

    Permalink

    methods for creating SpecificationStructure instances from fragments

  16. object StandardFragments

    Permalink

    Those standard Fragments are used to format the specification text:

    Those standard Fragments are used to format the specification text:

    • End() can be used to "reset" the indentation of text
    • Br() can be used to insert a newline
    • Tab() can be used to increment the indentation level
    • Backtab() can be used to decrement the indentation level
  17. object Stats extends Product with Serializable

    Permalink

    The Stats class store results for the number of: - successes - expectations - failures - errors - pending - skipped

    The Stats class store results for the number of: - successes - expectations - failures - errors - pending - skipped

    for each example

  18. object Step extends ImplicitParameters with Product with Serializable

    Permalink
  19. object TagFragments

    Permalink

    Those fragments are used to tag other fragments in a specification\

  20. object Tags extends Tags

    Permalink
  21. object Text extends Serializable

    Permalink
  22. package script

    Permalink

Ungrouped