spek icon indicating copy to clipboard operation
spek copied to clipboard

Discovery failure should fail spek

Open robstoll opened this issue 6 years ago • 2 comments

Maybe similar to #566 but opening it nonetheless as it does not seem to be fixed. Following the use case:

  • JVM platform
  • one forgets to add runtimeOnly "org.spekframework.spek2:spek-runner-junit5:$spek2_version"
  • gradlew build

The project builds fine even though no tests are executed due to the above failure.

robstoll avatar Aug 28 '19 21:08 robstoll

That's a quite different than #566. #566 was about an exception thrown during the discovery phase, and that's definitely fixed.

Your issue is about forgetting to add the test runner. I'm unsure what can be done there. One must use a test runner, if you don't then of course test won't be run. That's how the Junit5 platform works.

Junit5 behaves the same: If you forget testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.1"), then no Junit5 test will be executed and your build will succeed.

jcornaz avatar Sep 05 '19 08:09 jcornaz

good it is different, in this case this issue has its right to exist :slightly_smiling_face: With junit you can use --fail-if-no-test. The build then fails in case no tests are detect. Maybe spek could expose it? I actually had a different use case where Spek could not run due to a problem in my code. The only thing I got was a warning in the console from junit saying that the engine Spek failed. Unfortunately, I cannot remember how this happend and that is why I came up with the use case in the description

robstoll avatar Sep 05 '19 09:09 robstoll