what is really weird is that I don't have any issu...
# spek
s
what is really weird is that I don't have any issues running it with maven through the command line, but I think that's because it's actually not running. I can't get surefire to actually run the test.
h
what version of IntelliJ and version of the Spek Runner?
s
Copy code
IntelliJ IDEA 2017.1.2
Build #IU-171.4249.21, built on April 19, 2017
Licensed to Tyler Thrailkill
Subscription is active until May 10, 2017
JRE: 1.8.0_112-release-736-b16 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.3
Copy code
<dependency>
            <groupId>org.jetbrains.spek</groupId>
            <artifactId>spek-api</artifactId>
            <version>1.1.0</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>org.jetbrains.spek</groupId>
            <artifactId>spek-junit-platform-engine</artifactId>
            <version>1.1.0</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-runner</artifactId>
            <version>1.0.0-M4</version>
            <type>pom</type>
        </dependency>
spek plugin 0.3.4
@hhariri ^ is that what you were asking for?
h
y. Are you using Spek runner or JUnit?
s
um. I'm not sure how to use one over the other. I thought it was just whether I used the
@RunWith()
annotation or not, so I tried with and without it and it breaks either way.
after I get that error, even if I remove the spek test and all the pom stuff intellij gives the same error on other tests. It's like it corrupts something in the intellij internals
r
can you try using
1.0.0-M3
rather than
1.0.0-M4
. M4 changed some API and broke spek.
s
hmm. now I'm getting
Copy code
INFO: Discovered TestEngines with IDs: []
Exception in thread "main" org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:207)
	at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:52)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
	at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:66)
	at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58)
I have
Copy code
INFO: Discovered TestEngines with IDs: []
Exception in thread "main" org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:207)
	at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:52)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
	at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:66)
	at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58)
and surefire looks like
Copy code
<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration>
                        <useFile>false</useFile>
                        <!-- Include Java test classes ending with Test (both Java and Groovy) -->
                        <includes>
                            <include>**/*Test.java</include>
                            <include>**/*Test.groovy</include>
                            <include>**/*Spek*.kt</include>
                        </includes>
                        <!-- Exclude integration tests when unit tests are run -->
                        <excludes>
                            <exclude>**/*IT.java</exclude>
                            <exclude>**/*SpringBootTest.java</exclude>
                        </excludes>
                        <!-- Provides VM arguments when unit tests are run. Mainly used by Surefire plugin to write to the correct
                            jacoco-execution-file for unit tests. -->
                        <argLine>${surefireArgLine}</argLine>
                        <!-- Skips unit tests if the value of property 'skip.unit.tests' is true -->
                        <skipTests>${skip.unit.tests}</skipTests>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.jetbrains.spek</groupId>
                            <artifactId>spek-junit-platform-engine</artifactId>
                            <version>1.1.0</version>
                            <type>pom</type>
                        </dependency>

                        <dependency>
                            <groupId>org.junit.platform</groupId>
                            <artifactId>junit-platform-runner</artifactId>
                            <version>1.0.0-M3</version>
                        </dependency>
                    </dependencies>

                </plugin>
Ok, I got it to work with a 'test' project that I found on github, but only with spek version 1.0.89. why does 1.1.0 not work?
but now in my real project I'm getting
Copy code
INFO: Discovered TestEngines with IDs: [spek]
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/engine/discovery/ClasspathSelector
	at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:48)
	at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:36)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:109)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
	at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:107)
	at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.discovery.ClasspathSelector
	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)
	... 6 more
Ok, I got it running using M2 of the engine, but it still doesn't run in intellij. anyone know why?