Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings
Open more actions menu

Latest commit

 

History

242 Commits
242 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spockk

This repository is home to Spockk, an add-on for the Spock testing framework that brings its expressive BDD-style syntax for Groovy to Kotlin.

Sneak preview

class WelcomeSpec : Specification() {
    fun `welcome to Spockk`(visitor: Being, greeting: String) {
        given
        val spock = Vulcan("Spock")

        expect
        spock.greet(visitor) == greeting

        where
        visitor         ; greeting
        Vulcan("Sarek") ; "Live long and prosper!"
        Human("Kirk")   ; "Hello!"
    }
}

Getting started

Development

High-level design

The Spock framework for Groovy relies on AST transformations to transform its expressive specification syntax into runnable specification classes. The Spockk add-on achieves a similar behavior by implementing a Kotlin compiler plugin (examples). The following diagram shows the simplified interaction between all the different components that Spockk is composed of.

graph TB
    gradle["spockk-gradle-plugin"]
    intellij["spockk-intellij-plugin"]
    spock["spock-core"]

    subgraph compiler["Kotlin Compiler"]
        sources["Sources (.kt)"]
        frontend["Compiler frontend"]
        backend["JVM IR backend"]
        plugin["spockk-compiler-plugin"]
        bytecode["Bytecode"]

        sources --> frontend
        frontend -->|generate intermediate representation| backend
        backend --> plugin
        plugin -->|transform IR into executable tests| bytecode
    end

    gradle -->|applies spockk-compiler-plugin| compiler
    intellij -->|detects specifications and features| sources
    spock -->|executes| bytecode
Loading

Modules

  • spockk-compiler-plugin: implements IR transformations that modify the simplified test syntax into tests compatible with Spock's test engine.
  • spockk-core: declares additional Kotlin-specific specification syntax.
  • spockk-docs: module with user guide.
  • spockk-gradle-plugin: Gradle plugin that abstracts away the application of the spockk-compiler-plugin to Kotlin compiler invocations.
  • spockk-intellij-plugin: provides support for Spockk tests in IntelliJ.
  • spockk-specs: specifications for the framework written with Spockk.

About

Add-on for the Spock testing framework bringing its expressive syntax to Kotlin

Topics

Resources

Contributing

Stars

28 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.