hi ,
I have made (a little bit) more elegant solution. I have in my project very nice HTTP mock with a number of response messages in it. I also have testcases using http to test services but also to test mock. I want to easy switch to JMS in my testcase, and using same http mock logic voor JMS Mock.
Make TestSuite and TestCase with next test steps;
1. testRequest named “JMS receive” – with empty request message, (like described by Nebojsa )
2. testRequest named “Send request to HTTPMock” – with this XML tab ${ JMS receive #Response} and endpoint to my http mock service.
3. testRequest named "JMS send" with jms endpoint that will send message to a reply queue, like
jms://activeMQSession::queue_testQ2 . In XML tab just write this ${ Send request to HTTPMock #Response} . In JMS Header in CorrelationID write ${=context.testCase.testSteps["JMS receive "].testRequest.response.responseHeaders.JMSMessageID}. This wil set correlationid of response message with value from messageid of request message (Correlation pattern).
4. Goto step (like Nebojsa described).
Run you http mock , run jms (mock ) test case , and you have the same mock available on http and on jms. Switch of endpoint in testcase give you possibility to easy test these mock’s on both transports.