Specsy unit testing framework, safely isolates mutable state
Specsy is a BDD-style unit-level testing framework for Scala, Groovy, Java and easily any other language on the JVM. It safely isolates mutable state, supports writing self-documenting tests/specifications, and runs all tests in parallel.
Specsy has all the essential features of a unit testing framework and nothing excess. To illustrate Specsy’s expressiveness, its public API has only three methods, but they provide functionality that requires about four printed pages of documentation to cover - more than Specsy even has production code.
The following example demonstrates Specsy’s isolated execution model.
Refer to the documentation to see more examples and to start using Specsy.
- Mailing list: http://groups.google.com/group/specsy
- Release notes: https://github.com/luontola/specsy/blob/master/RELEASE-NOTES.md
- Source code: https://github.com/luontola/specsy
- License: Apache License 2.0
- Developer: Esko Luontola (@orfjackal)
Project Goals
-
Unlimited Nesting - The specs can be organized into a nested hierarchy. This makes it possible to apply One Assertion Per Test which isolates the reason for a failure, because the specs are very fine-grained. This flexibility also makes writing specification-style tests easier.
-
Isolated Execution - To make it easy to write repeatable tests, each spec is isolated from the side-effects of its sibling specs. By default, each spec will see only the side-effects of its parent specs. Note that Specsy discourages writing non-repeatable fat integration tests, so a BeforeClass/AfterClass concept is outside the scope of this project (or at a very low priority - I have some ideas on how it could be done elegantly).
-
No Forced Words - In order to let you choose the best possible test names, Specsy does not impose any predefined words on its users.
-
Simplicity - Specsy contains only the essential features, but does them well. Having a particular assertion syntax is not essential and it’s easy to use the assertions of other testing libraries, so Specsy itself does not have assertions. Also any syntactic sugar is minimized, in order for it to be easy to know what the code does just by looking at it.
-
Parallel Execution - Running tests fast is a must for using TDD (my pain threshold for recompile and test execution is about 5-10 seconds). With Specsy all tests in a test class can be run in parallel, taking full use of all available CPU cores.