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

Mock server calls recording #489

Open
KayleighYum opened this issue Jan 3, 2024 · 4 comments
Open

Mock server calls recording #489

KayleighYum opened this issue Jan 3, 2024 · 4 comments

Comments

@KayleighYum
Copy link
Contributor

Would it be possible to support recording all calls made to the server? The recording would store the request url, method and body (if exists)
The reasons for this would be:

  • Confirming that all/specific mock files are used
  • Confirming the number of calls made to the mock server
  • Confirming that specific calls were made in tests where the return value is not used/relevant.
@divdavem
Copy link
Member

divdavem commented Jan 8, 2024

Hi @KayleighYum
Thank you for opening this issue.
It is already possible to do whatever recording you need by implementing the hook function in the config. You can, for example, store in a file the information you want to check about each request, or if you run kassette from the same process as your (node.js-based) test runner, you can even do the recording in a js object in memory only and access the same object from your test.
Would this work for your use case?

@KayleighYum
Copy link
Contributor Author

Hi @divdavem we currently have a worker running the mock server and another one running our tests. We're have specified certain endpoints to the mock server to return/alter state that we're storing in the mock server. This is working fine but we were wondering if this could be improved.

Previous iterations of this was using the onListen hook to start up a readiness server and then used that server for state management.

@divdavem
Copy link
Member

Thank you for your answer!

This is working fine but we were wondering if this could be improved.

I like the way you implemented it. 👍
How would you improve it? What would you expect from the improved solution?

@KayleighYum
Copy link
Contributor Author

Currently we're using the hook method to check if the place starts with certain keywords, wrapping the state in a payload and using the hook to return the response from the payload. It's a very hardcoded if/else statement that could become finicky later on

It would be great if it could come from the package for others to use. Is this something that is in scope?

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

2 participants