Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JUnit and Junit5 reporting on failures of amqp tests #1267

Open
anto-ac opened this issue Dec 9, 2020 · 4 comments
Open

Improve JUnit and Junit5 reporting on failures of amqp tests #1267

anto-ac opened this issue Dec 9, 2020 · 4 comments

Comments

@anto-ac
Copy link
Collaborator

anto-ac commented Dec 9, 2020

When Amqp tests fail, it's very hard to understand which interaction has failed, as neither the consumer nor the interaction are reported. Showing at least the consumer name (and ideally the tag) would make it much easier to understand failures.

Current example output:

[ERROR] Tests run: 58, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 31.678 s <<< FAILURE! - in com.xxx.xxx.xxx.pact.provider.AmqpPactProviderTest
[ERROR] verifyPact{PactVerificationContext}[22]  Time elapsed: 0.091 s  <<< FAILURE!
java.lang.AssertionError: 
Failures:
1) xxxCreatedEvent generates a message which
    1.1) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":10} (Object) to be the same type as 10 (Integer)
	at com.xxx.xxx.xxx.pact.provider.AmqpPactProviderTest.verifyPact(AmqpPactProviderTest.java:xxx)
[ERROR] verifyPact{PactVerificationContext}[23]  Time elapsed: 0.079 s  <<< FAILURE!
java.lang.AssertionError: 
Failures:
1) xxxDuplicatedEvent generates a message which
    1.1) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":2} (Object) to be the same type as 2 (Integer)
    1.2) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":1} (Object) to be the same type as 1 (Integer)
	at com.xxx.xxx.xxx.pact.provider.AmqpPactProviderTest.verifyPact(AmqpPactProviderTest.java:xxx)
[ERROR] verifyPact{PactVerificationContext}[51]  Time elapsed: 0.075 s  <<< FAILURE!
java.lang.AssertionError: 
Failures:
1) xxxCreatedEvent generates a message which
    1.1) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":10} (Object) to be the same type as 10 (Integer)
	at com.xxx.xxx.xxx.pact.provider.AmqpPactProviderTest.verifyPact(AmqpPactProviderTest.java:xx)
[ERROR] verifyPact{PactVerificationContext}[52]  Time elapsed: 0.061 s  <<< FAILURE!
java.lang.AssertionError: 
Failures:
1) xxxDuplicatedEvent generates a message which
    1.1) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":2} (Object) to be the same type as 2 (Integer)
    1.2) BodyMismatch: $.domainEvent.xxx BodyMismatch: Expected {"id":1} (Object) to be the same type as 1 (Integer)
	at com.xxx.xxx.xxx.pact.provider.AmqpPactProviderTest.verifyPact(AmqpPactProviderTest.java:xxx)
@uglyog
Copy link
Member

uglyog commented Dec 26, 2020

Oh, the message description is not displayed. Yeah, that is not helpful at all.

@uglyog
Copy link
Member

uglyog commented Dec 26, 2020

Ignore that comment: xxxCreatedEvent is the description. So just the consumer name and tags should help you.

@uglyog
Copy link
Member

uglyog commented Dec 27, 2020

I've included the JUnit description in the error message. The downside is that in Gradle test reports it will be duplicated.

java.lang.AssertionError: test_consumer - Generates message 'a test message'  (au.com.dius.pact.provider.junit.MessageTest)
Failures:

1) a test message: generates a message which has a matching body

    1.1) body: $ Expected testParam2='value2' but was missing

          "testParam1": "value1",
        -  "testParam2": "value2"
        +  "testParam3": "value2"
        }

@uglyog
Copy link
Member

uglyog commented Dec 28, 2020

4.1.13 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants