Skip to content


This style is inspired by test frameworks like Jasmine and RSpec.

object CalculatorSpec: Spek({
    describe("A calculator") {
        val calculator by memoized { Calculator() }

        describe("addition") {
            it("returns the sum of its arguments") {
                assertThat(3, calculator.add(1, 2))


Defined by either calling describe or context, they are used to group related specs.


Defined by calling it, is the place where you usually place your assertions/checks.


describe, context and it can be prefixed with an x which will tell Spek to skip them during execution.


This style also provides aliases to the built-in fixtures.

  • before and after is equivalent to beforeGroup and afterGroup, respectively.
  • beforeEach and afterEach is equivalent to beforeEachTest and afterEachTest, respectively.