A Specification Framework

Some time ago I started working on a specification framework for the JVM, something that allows me to write specifications (i.e. tests) in a more
human readable way, and what’s more important, descriptive manner, without having to resort to underscores or very long test names.

It’s now reached its first milestone, not without the efforts of Ilya, Eugene and Steve, and now
in a state that it can be used in applications.

Spek

If you’re familiar with Jasmine, Mocha or Machine Specifications, then you’ll immediately see the resemblance

If you’re not familiar with this style of syntax, let me briefly explain:

Given - Establish the context of the test, i.e. Arrange

On - Execute the action, i.e. Act

It - Validate the restuls, i.e. Assert

Spek allows you to have more than one action for the same context, that is for the same given. It also allows you to have more than one it for the same
action. It’s good practice (well I say so), that you keep each it with a single assertion.

What language is that?

Spek is written in Kotlin, but your code doesn’t need to be. Kotlin is 100% compatible with Java, which means that you can test/write your specifications in Kotlin
and keep your code in Java (if you really want to that is).

How do I run it?

IntelliJ IDEA supports Spek, so does TeamCity. There’s also a console runner which outputs Text and HTML (still in the works).

What next?

Hoping that you like what you see, head over to the Spek web site to find out more and download it. It’s Apache 2 OSS license
and source code is available on GitHub.