pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

Gradle and Maven plugins don't log the results of matching response bodies #82

Closed uglyog closed 9 years ago

uglyog commented 9 years ago

This makes it difficult to diagnose the cause of matching failures.

algra commented 9 years ago

Would it be possible to have that in test failure output instead of debug log output? Something like:

*** FAILED ***
  ResponseMismatch did not equal FullResponseMatch:
  Status 400 is not equal 200.
  Body XYZ is not equal ZYX. 
 (PactSpec.scala:32)
  org.scalatest.exceptions.TestFailedException:
  at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:500)
  at org.scalatest.FreeSpec.newAssertionFailedException(FreeSpec.scala:1740)
  at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:466)
  at au.com.dius.pact.provider.PactSpec$$anonfun$2$$anonfun$apply$1.apply$mcV$sp(PactSpec.scala:32)
  at au.com.dius.pact.provider.PactSpec$$anonfun$2$$anonfun$apply$1.apply(PactSpec.scala:18)

instead of

*** FAILED ***
  ResponseMismatch did not equal FullResponseMatch (PactSpec.scala:32)
  org.scalatest.exceptions.TestFailedException:
  at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:500)
  at org.scalatest.FreeSpec.newAssertionFailedException(FreeSpec.scala:1740)
  at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:466)
  at au.com.dius.pact.provider.PactSpec$$anonfun$2$$anonfun$apply$1.apply$mcV$sp(PactSpec.scala:32)
  at au.com.dius.pact.provider.PactSpec$$anonfun$2$$anonfun$apply$1.apply(PactSpec.scala:18)

Reason for that is that we're messing around (like asserting that things are getting logged our way for different log levels, etc.) with log outputs in our acceptance testing, so, it could interfere just debug output.

uglyog commented 9 years ago

The debug log was for the gradle and maven plugins. If you're using PactSpec we should be able to change the failure message.

uglyog commented 9 years ago

@algra the failure message with PactSpec now looks like:

provider Animal_Service interaction "a request for alligators" in state: "an error has occurred" * FAILED * There were response mismatches: StatusMismatch(500,400) BodyTypeMismatch(application/json,text/plain)

algra commented 9 years ago

Great, thanks for changing that!