1

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

Geert Olaerts
  • 1,155
  • 2
  • 9
  • 17

1 Answers1

1

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'
guenhter
  • 11,255
  • 3
  • 35
  • 66
  • Pretty sure i have those, see my maven file – Geert Olaerts Jul 12 '17 at 06:49
  • Please lower the versions of `junit-platform-runner` and `junit-jupiter-api` from `...-M5` to `...-M4` (displayed in the snippet of this answer). This will fix your problem. Reason is that there are some breaking changes in the milestones which are not longer compatible. I'm sure, that this will be fixed in future releases, but for now, avoid using the `M5` milestone. – guenhter Jul 12 '17 at 07:13
  • Thanks, i figured latest version is always the best. Now to get surefire maven to pick up my specs. Thanks for the help – Geert Olaerts Jul 12 '17 at 07:56
  • If this solves your problem, just mark it as solved pls. So others know that this one is done. – guenhter Jul 12 '17 at 11:02