I’m after some advice regarding a project I am currently working on. There is a front-end, similar to what Amazon is like in that sales are fed through the site(there is no API for doing this). However, the requirement I have is to test the microservices that sit behind the UI which go off to various warehouse management systems.
The issue I have is that in order to test each of these services it’s dependent on data being passed through from the UI. Obviously it’s fine to do this, but each of these tests will take a while to run; what I’m interested in is more of the integration behind each of these micro-services, rather than having to worry too much about the API. Does anyone have any advice about how I could go about this?
I think it’s a healthy idea to separate UI evaluations from API behavior! If you have the API endpoints (these look like URLs) and the format of the payload (usually a JSON format), then you might consider Postman for your evaluations.
what I’m interested in is more of the integration behind each of these micro-services, rather than having to worry too much about the API
This reads to me like you just want a test to verify that the UI makes the proper API call, and that you don’t care about the underlying API? i.e. that if they click on the “update cart” button or something, the payload should be something like:
{"itemId": "foo", "quantity":1, "cartId": "bar"}
You want your test to just verify the UI does that, and that seems like it should be doable by mocking the micro-services, and just have dummy responses come back quickly and eliminate the timing issues.
I do think this is contrary to “the requirement I have is to test the microservices” - i.e. you’re just going to be testing the contracts, and not the actual microservices
Thanks for the response Ernie. Could I potentially build a series of classes which contain the payload which the API is expecting, in order to mock the API?
Thanks Ali. I’ve actually managed to do something like that using RestSharp in that I’ve build a series of classes which contain the data to be passed in the API. And each test I have can then pass across different sub-sets of data of my choosing