stacktrace: ``` Nov 06, 2017 7:19:28 AM org.junit....
# spek
p
stacktrace:
Copy code
Nov 06, 2017 7:19:28 AM org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'spek' failed to discover tests
java.lang.IllegalAccessError: tried to access method org.junit.platform.engine.support.descriptor.ClassSource.<init>(Ljava/lang/Class;)V from class org.jetbrains.spek.engine.SpekTestEngine
	at org.jetbrains.spek.engine.SpekTestEngine.resolveSpec(SpekTestEngine.kt:114)
	at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:80)
	at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:50)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
	at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:107)
	at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58
pom.xml
Copy code
<dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jre8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.jkcclemens</groupId>
            <artifactId>khttp</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.knowm.xchart</groupId>
            <artifactId>xchart</artifactId>
            <version>3.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.spek</groupId>
            <artifactId>spek-api</artifactId>
            <version>1.1.5</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.spek</groupId>
            <artifactId>spek-junit-platform-engine</artifactId>
            <version>1.1.5</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.amshove.kluent</groupId>
            <artifactId>kluent</artifactId>
            <version>1.30</version>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-runner</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>
My test is in
src/test/kotlin
Copy code
object Test: Spek({
    describe("a calculator") {

        it("should return the result of adding the first number to the second number") {
            "test" shouldEqual "test"
        }

        it("should return the result of subtracting the second number from the first number") {
        }
    }
})
r
can you try using junit platform
1.0.1
?
p
Why is it not in the documentation? All the documentation says about Maven is that we should add
spek-api
...
r
Actually can you paste the whole pom.xml? Based on the error there might be some class compatibility issues.
p
So what dependencies do I need?
spek-api
is definitely not enough which is all the guide mentions.
Then there is a confusing hodge podge of junit4 vs junit??? variants in Gradle from which none work. There is not a single working set up on that whole page and no sample maven project using spek.
r
You have everything, I can't help you if you don't paste the build script.
p
I will paste it when I get home but there is nothing special in it. Just the kotlin maven plugin.
this works together..
Copy code
<dependency>
    <groupId>org.jetbrains.spek</groupId>
    <artifactId>spek-api</artifactId>
    <version>1.1.5</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.jetbrains.spek</groupId>
    <artifactId>spek-junit-platform-engine</artifactId>
    <version>1.1.5</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-runner</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
notice there is no
<type>pom</type>
I am clearly using junit 4 but I didnt need any
@RunWith
anotation so that part is also wrong in the docs.
r
Yeah, something is wrong with the docs. I remember the maven section being several lines long.
p
it would be nice if there was a
spek
artifact that pulls all the other 3 dependencies as children..
r
For now please take a look at https://github.com/spekframework/spek-maven-sample, it's using an old version but it's a good start.