Hi. I'm new to Spek. Trying to get my first tests ...
# spek
w
Hi. I'm new to Spek. Trying to get my first tests to run. I'm having trouble with the "given, on, it" style. My tests don't run. If I leave out the "on" then the test does run. Any thoughts on what I might be doing wrong?
a
code please
w
@RunWith(JUnitPlatform::class) class ProjectResourceSpec : Spek({ given("a project resource") { on("field reference") { it("should get the value from the delegate") { val name = "PROJECT" val project = Project(name = name) val resource = ProjectResource(project) assert.that(resource.name, equalTo(name)) } } } }) No tests run
But it runs if with this: @RunWith(JUnitPlatform::class) class ProjectResourceSpec : Spek({ given("a project resource") { it("should get the value from the delegate") { val name = "PROJECT" val project = Project(name = name) val resource = ProjectResource(project) assert.that(resource.name, equalTo(name)) } } })
a
are you running using IDEA plugin or console?
w
Both
IDEA and Maven
a
the first one works on my side
could you post Spek and JUnit dependencies?
w
<!-- Spek --> <dependency> <groupId>org.jetbrains.spek</groupId> <artifactId>spek-api</artifactId> <version>1.1.3</version> <!--<scope>test</scope>--> </dependency> <dependency> <groupId>org.jetbrains.spek</groupId> <artifactId>spek-junit-platform-engine</artifactId> <version>1.1.3</version> </dependency>
<!-- JUnit --> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-runner</artifactId> <version>1.0.0-RC3</version> </dependency>
a
yeah, I can confirm the first one doesn’t work with Spek 1.1.3 and JUnit RC3
but works with 1.1.2 and M4
@raniejade
w
Thanks @adambl4. I changed my build to use 1.1.3 and M4. Now the test runs in Maven, but it is marked as "not started" when I run using the Idea plugin.
Process finished with exit code 255
r
can you try w/ Spek
1.1.4
and JUnit Platform
1.0.0-RC2
? Also if possible don't use
@RunWith(...)
JUnit 4 is so problematic.
w
That combo does seem to work. I hadn't tried 1.1.4 because its not in Maven Central (any reason for that?). Once I got it from Bintray with JUnit RC2, it worked.
h
It should have been on Maven. I’m publishing it now