guides icon indicating copy to clipboard operation
guides copied to clipboard

Cannot see Spock failed tests error messages with Gradle 6.2.2

Open daggerok opened this issue 5 years ago • 1 comments

steps to reproduce

clone project and run tests

git clone https://github.com/daggerok/groovy-examples.git
cd groovy-examples/ && ./gradlew clean test

actual

> Task :collectins:test FAILED

AppTest > should iterate using step FAILED
    org.spockframework.runtime.SpockComparisonFailure at AppTest.groovy:18

1 test completed, 1 failed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':collectins:test'.
> There were failing tests. See the report at: file:///private/tmp/groovy-examples/collectins/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

expected

see similar error message, like I can see in my IDEA: image

or similar to what I can see in build/reports HTML: image

project gradle build configuration

subprojects {
  apply plugin: 'groovy'
  sourceCompatibility = '1.8'
  repositories.jcenter()

  dependencies {
    implementation 'org.codehaus.groovy:groovy-all:2.5.10'
    testImplementation platform('org.spockframework:spock-bom:2.0-M1-groovy-2.5')
    testImplementation 'org.spockframework:spock-core'
    testImplementation 'org.spockframework:spock-junit4'
  }

  test {
    useJUnitPlatform()
    testLogging {
      showCauses = true
      showExceptions = true
      showStackTraces = true
      showStandardStreams = true
      events 'passed', 'skipped', 'failed'
    }
  }
}

PS: using gradle init task with additional guides and configuration examples:

  • https://guides.gradle.org/testing-gradle-plugins/
  • https://github.com/spockframework/spock-example

Regards, Maksim

daggerok avatar Mar 18 '20 11:03 daggerok

I'm hitting this same problem. I did discover that running Gradle with "--info" level output causes the Spock error details to appear, along with a ton of other info-level status messages. It would be preferable if the assertion details would be shown even without the "--info" flag.

TheFriendlyCoder avatar Oct 23 '22 17:10 TheFriendlyCoder