0

I have a Gradle build using JUnit 5 to run Spek tests.

Some of the tests fail during setup:

Feb 17, 2020 4:38:42 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'spek' failed to discover tests
java.lang.NullPointerException
        at <redacted>.SparkEval.generateEvalTaskDescs(SparkEval.kt:157)
        at <redacted>.TestFilterConfigs$1.invoke(TestFilterConfigs.kt:70)
        at <redacted>.TestFilterConfigs$1.invoke(TestFilterConfigs.kt:34)

However it doesn't count as error, and test framework just ignores these.

Relevant part of the Gradle config is:

  junitPlatform {
    platformVersion "1.0.3"
    filters {
      engines {
        include 'spek'
        include 'junit-vintage'
      }
    }
    enableStandardTestTask true
  }

  test {
    testLogging {
      showStandardStreams = false
    }
    reports {
      junitXml.enabled = true
      html.enabled = true
    }
    finalizedBy jacocoTestReport
    finalizedBy testReport
  }

Is there a configuration option I can use so it fails the tests if there's an error setting up a test suite?

Midiparse
  • 4,701
  • 7
  • 28
  • 48
  • Have you checked the behaviour using the latest platform version 1.6.0? – johanneslink Feb 18 '20 at 04:54
  • Yes, sadly spek is incompatible with that version. Upgrading to spek 2 and platform version 1.6.0 solves this issue, however that requires rewriting all my tests – Midiparse Feb 18 '20 at 15:27

0 Answers0