M_McDonald
16 years agoSuper Contributor
Handling asynchronous responses in test cases
In a test case I call a service which responds immediately with an order number, but then later will make a callback to a URL to provide further details. I can use a Mock Service to intercept the callback in the OnRequest event when there is only one order being processed, but normally there are multiple orders being processed at any one time so I may intercept the callback for a different order.
What I am looking for is a technique that would allow the test case to "register" the order number with the Mock Service, then suspend itself until the matching callback was received by the Mock Service, which would then pass back the infomation received in the callback request to the appropriate test case and cause it to resume execution. This would allow testing in a busy environment and also parallel execution and load testing of this service.
Any suggestions?
What I am looking for is a technique that would allow the test case to "register" the order number with the Mock Service, then suspend itself until the matching callback was received by the Mock Service, which would then pass back the infomation received in the callback request to the appropriate test case and cause it to resume execution. This would allow testing in a busy environment and also parallel execution and load testing of this service.
Any suggestions?