I understand the concept of mocking API responses and their uses in unit testing, but in functional/integration testing, I actually don't want to mock because that defeats the purpose.
For example, if I have microservice A and B. A user creates a record with A, and A needs to send some data to B, and B creates another record on its end. B requires parameters 1, 2, and 4. However, in a mock, there is nothing that will guarantee the contract of service B because that API call isn't actually made.
Right now I have a docker container for each service, and I'm sort of lost on how to create this test.
The only thing I can think of is:
- Spin up the containers required for the test
- Create record with microservice A
- Test the existence of the record in A
- Don't mock the call from A to B (so that B also creates its own record)
- Test the existence of the record in B
- Spin down the containers
Any ideas on how best to do this?