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

Using spies to construct mocks #17

Open
gnecula opened this issue Oct 22, 2015 · 0 comments
Open

Using spies to construct mocks #17

gnecula opened this issue Oct 22, 2015 · 0 comments

Comments

@gnecula
Copy link
Owner

gnecula commented Oct 22, 2015

This is more of an idea for extending Bond.

I am in the middle of writing tests for a complex REST api interaction with multiple dependent round trips. It is a pain to collect the mock results. I keep going back and forth between the production system and the test, trying to get to the response to my requests in a debugger to save them to a file so that I can use them in mocks.

It just occurred to me that we are in a unique position to use spies to actually build the mocks. If you somehow turn on spying in production code, then you can use those observations as mock results.

Other mocking systems that are not coupled with spying may not be able to use replay. I am wondering how exactly to do this.

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

1 participant