On this page
Spek Testing Framework
Overview
Qualified supports writing tests for Kotlin using Spek.
Basic Example
Solution
fun add(a: Int, b: Int) = a + b
Tests
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
import kotlin.test.assertEquals
class ExampleSpec : Spek({
describe("add") {
it("should return the sum") {
assertEquals(2, add(1, 1))
}
}
})
Assertion Libraries
Following assertion libraries can be used:
Learn More
You can learn more on the Spek website.