Consider that I have an API end-point localhost/add-page-view. When we send a post request with data {url: "google.com"} it will be sent to a message queue, then later will be inserted to the DB by the queue subscriber
I need to write a test case that will send a post request to this end-point, then check whether "google.com" has been inserted to DB. Since it's inserted via Message Queue, we aren't sure whether it's inserted or not.
One way is to post data to end-point after 2 seconds check whether it has been inserted
But, that doesn't sound like a good option. Any thoughts?
Note: It's an integration test, not a unit test
j
stuff ;)
I thought about those approaches
In theory you could test the different integrations between the parts of your software as well
if a -> b works and b -> c works and c -> d works
a -> b -> c -> d also works
maybe just keeping the state of the sequences withing the integration test but than you would need to keep the test sequence in order. or you move in the function it depends if you're doing it OOP or FP I guess.
i am just thinking out loud here, I guess most of these thought already crossed your mind. hope this helps at least little.