1
votes

Trying to get spek working with kotlin but running into some problems. I have the simplest test:

object TestSpec : Spek({
    describe("A greeter") {
            it("should fail") {
                "hello" shouldEqual "somethingelse"
            }
    }
})

And it doesn't work. I have tried the following variations:

object TestSpec : Spek({
    describe("A greeter") {
            it("should fail") {
                "hello" shouldEqual "somethingelse"
            }
    }
})

This test is green, it clearly should not be.

object TestSpec : Spek({
    describe("A greeter") {
        on("something") {
            it("should fail") {
                "hello" shouldEqual "hellosdf"
            }
        }
    }
})

This test doesn't even run. When i execute it i just get

Test framework quit unexpectedly

Same for the following variation:

object TestSpec : Spek({
    given("A greeter") {
        on("something") {
            it("should fail") {
                "hello" shouldEqual "hellosdf"
            }
        }
    } 
})

My maven dependencies:

<dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jre8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>

    <dependency>
        <groupId>org.jetbrains.spek</groupId>
        <artifactId>spek-api</artifactId>
        <version>1.1.2</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.spek</groupId>
        <artifactId>spek-junit-platform-engine</artifactId>
        <version>1.1.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.amshove.kluent</groupId>
        <artifactId>kluent</artifactId>
        <version>1.24</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-runner</artifactId>
        <version>1.0.0-M5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.0.0-M5</version>
        <scope>test</scope>
    </dependency>

If i run the test now i just get Test framework quit unexpectedly without any other information.

Also put the code on github, might be easier if somebody wants to check link

1
Please run gradle with the options ./gradlew build --info --stacktrace to it and post the output.guenhter
I am using maven sadly. Updated to show what more i knowGeert Olaerts

1 Answers

1
votes

It seems that you have a missing dependency (http://spekframework.org/docs/latest/#setting-up-legacy). Check that you have those:

org.jetbrains.spek:spek-api:1.1.2
org.jetbrains.spek:spek-junit-platform-engine:1.1.2
org.junit.platform:junit-platform-runner:1.0.0-M4

// this one too if you use IntelliJ
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0-M4'