Skip to content

Specs2

specs2 is a testing library for Scala that supports both acceptance-style and unit-style specifications. Eric Torreborre created it as a successor to the original specs library, focusing on composability and readable test output. Specifications are written in a behavior-driven development (BDD) style where test descriptions read as natural-language sentences describing expected behavior.

The current release is specs2 5.0. The library provides a rich set of matchers for comparing values, strings, collections, exceptions, and JSON. Data tables allow parameterized tests with multiple input/output combinations in a tabular format. Acceptance specifications separate the description text from the test code, making them suitable for documentation. Unit specifications use a more traditional should/in block structure. specs2 integrates with sbt, ScalaTest, and JUnit runners.

The project website includes a quickstart guide and full API documentation. The source code is on GitHub under the MIT license.

etorreborre.github.io/specs2

Related technologies

Let's build something together

Whether it's a shared project, a partnership, or contributing to something bigger — we're always open to building together.