raniejade / spek-idea-plugin

MIT License
48 stars 15 forks source link

Test framework quit unexpectedly #32

Closed jakob-grabner closed 7 years ago

jakob-grabner commented 7 years ago

When I try to run a test i get the following exception. Running the test with the junit (@RunWith(JUnitPlatform::class)) does work.

Exception in thread "main" java.lang.ClassNotFoundException: org.jetbrains.spek.tooling.MainKt
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
raniejade commented 7 years ago

That's weird, it seems you're missing some classes in the plugin. Can you provide your setup? If your using gradle/maven, please provide a build script :)

DevJake commented 6 years ago

I'm also receiving the same error message, but not receiving any stack trace, just a red, flagged message in the testing console of IntelliJ. Using @RunWith(...) doesn't alter the issue, either, but it seems that I can run individual tests, yet am unable to use the 'package' feature, meaning testing has to be performed on a per-file basis.

This is the contents of my build.gradle;

buildscript {
    ext.kotlin_version = '1.1.4'

    repositories {
        mavenCentral()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url "http://dl.bintray.com/jetbrains/spek" }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.9.14'
        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M4'
    }
}

plugins {
    id 'idea'
    id 'java'
    id 'application'
    id 'org.jetbrains.kotlin.jvm' version '1.1.4'
}
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'org.junit.platform.gradle.plugin'

sourceCompatibility = 1.8

junitPlatform {
    reportsDir file("$buildDir/test-results/spek")

    filters {
        engines {
            include 'spek'
        }
    }
}

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"

    testCompile "org.jetbrains.spek:spek-api:1.1.2"
    testCompile "org.jetbrains.spek:spek-junit-platform-engine:1.1.2"
    testCompile "org.jetbrains.kotlin:kotlin-test"
    testCompile "org.junit.platform:junit-platform-runner:1.0.0-M4"

    testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-M4"
    testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-M4"

    testCompile "com.winterbe:expekt:0.5.0"
}