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

Misleading "No interaction" summary message in some situations #77

Open
TimothyJones opened this issue Sep 1, 2017 · 7 comments
Open

Comments

@TimothyJones
Copy link
Contributor

When an interaction described in the test suite differs from the interaction sent by the client, the summary message is something like:

  1) SomeProvider service View can add a new view :
     No interaction found for PATCH /view/

It's easy to read this as implying that the problem is with the POST or the /view/ not matching in the request, when it might be because the request fails to match for other reasons (such as a different body content or headers).

Further up, the detailed output says:

Pact verification failed!
Actual interactions do not match expected interactions for mock MockService.

Incorrect requests:
	PATCH /view/0 (request body did not match)

See /Users/tjones/office/jobsearch-malcolm-ui/logs/pact.log for details.
        2) "after each" hook for ""

I think the incorrect requests line there: PATCH /view/0 (request body did not match) would be a better summary than the No interaction found message.

If there's no easy way to pull a good summary for all the cases that cause No interaction, then an easy improvement would be:

No interaction found for PATCH /view/ (see detailed output above)

Happy to contribute PRs if it would be helpful.

@bethesque
Copy link
Member

I'm trying to find the code that provides that "No interaction found for" message, and this is what I found:

def self.response interaction_mismatch
          response = {
            message: "No interaction found for #{interaction_mismatch.actual_request.method_and_path}",
            interaction_diffs:  interaction_mismatch.to_hash
          }
          [500, {'Content-Type' => 'application/json'}, [response.to_json]]
        end

I'm not sure if something in the js is stripping out that extra info, or if it's a ruby thing. Can you post the full logs? Or better yet, fork the pact-js repo and create a running example.

@TimothyJones
Copy link
Contributor Author

TimothyJones commented Sep 1, 2017

Here's an example of the test output, and here's the pact.log

Can create an example if that doesn't illustrate the problem well enough.

@bethesque
Copy link
Member

You're right, that is not helpful output. I'm still not sure exactly where the "No interaction found for PATCH /view/0" is being printed from. Can you throw together an executable for me by forking pact-js and modifying one of these https://github.com/pact-foundation/pact-js/tree/master/examples

I'll have a play with it locally if I can find time, or maybe @mefellows can.

@TimothyJones
Copy link
Contributor Author

Here's an example:

https://github.com/TimothyJones/pact-js/tree/issue-77/examples/issue-77

The output is slightly different, because I used the test runner from one of the other examples, but the error message is the same.

@vashchukmaksim
Copy link

vashchukmaksim commented Apr 17, 2019

@TimothyJones did you find a reason for the error?

@TimothyJones
Copy link
Contributor Author

You can tell why the error is happening from the more detailed log file (presuming your log level is configured high enough).

This issue was about improving the error message to include the relevant details from the log - but I don’t think anyone had time to look into it yet.

@TimothyJones
Copy link
Contributor Author

The error means that the actual request didn’t match the expected one for some reason- but the error suggests (sometimes incorrectly) that the http method and URL weren’t correct.

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