Hey,
We have two .NET http api services. Let's say Service A and Service B. We use Azure Service Bus with Mass Transit implementation to communicate between the services.
Of course, we write unit tests in each service. Now we write integration tests and API/E2E tests using JMeter. And one thing is not clear to me. A simple example.
I have a service A which say starts processing an order and then publishes a message to ASB that the order is processed and the message is picked up by service B which does its operation on the order and returns to service A.
And here comes my question and also a bit of confusion. Where should this test be located?
If I understand correctly, the integration tests are within one service. And should I for example just check yes message to ASB was sent, API was called etc. Or should I have service B really running next to it and check, whether by ASB, API or otherwise, that it has done its operation with the workaround? But then there's more confusion about the fact that I'd be testing the logic from service A, but probably not from service b, so it wouldn't make much sense. Thus, I would expect that the case where I'm really already testing scenarios I should test using E2E tests. Is my idea correct?
I've read the pages about testing and best practices from microsoft, but I haven't quite found my use case exactly. It's entirely possible that it's simple and I'm asking for an obvious thing, but for me it's just not that clear.
Thank you
Hey,
We have two .NET http api services. Let's say Service A and Service B. We use Azure Service Bus with Mass Transit implementation to communicate between the services.
Of course, we write unit tests in each service. Now we write integration tests and API/E2E tests using JMeter. And one thing is not clear to me. A simple example.
I have a service A which say starts processing an order and then publishes a message to ASB that the order is processed and the message is picked up by service B which does its operation on the order and returns to service A.
And here comes my question and also a bit of confusion. Where should this test be located?
If I understand correctly, the integration tests are within one service. And should I for example just check yes message to ASB was sent, API was called etc. Or should I have service B really running next to it and check, whether by ASB, API or otherwise, that it has done its operation with the workaround? But then there's more confusion about the fact that I'd be testing the logic from service A, but probably not from service b, so it wouldn't make much sense. Thus, I would expect that the case where I'm really already testing scenarios I should test using E2E tests. Is my idea correct?
I've read the pages about testing and best practices from microsoft, but I haven't quite found my use case exactly. It's entirely possible that it's simple and I'm asking for an obvious thing, but for me it's just not that clear.
Thank you
Share Improve this question asked Feb 5 at 11:26 pietropietro 1853 silver badges14 bronze badges1 Answer
Reset to default 0I can think of the following option:
- Use a mock of the service B which will be just consuming messages from the queue (you can even use JMeter for this)
- Build a E2E test and measure the time up to processing messages from the queue by the service B. You can wait for completion by either querying the service B or counting the number of messages in the queue and wait until it becomes zero using i.e. JSR223 Sampler and While Controller combination