Ask a Question

Asynchronous Service

SOLVED
zitryss
Occasional Contributor

Asynchronous Service

Hello everyone,

 

I am trying to create a test case for an asynchronous service, but the problem is that I have 2 different bindings where responses may come from.

 

          0.png

 

And more important: only one response comes each time. So, as you may guess, the main problem is how to start both listeners simultaneously and stop execution as soon as the first response comes.

 

          Confirmation response is received          Fault response is received

          1.png                               2.png

 

I've already tried to set up the "Start Step" in MockResponses, as it is described here, so 2 test steps could start at the same time, but it seems that this option is designed to help only when all the responses supposed to come.

 

Do you have any ideas?

 

Sincerely,

Eugene

1 ACCEPTED SOLUTION

Accepted Solutions
zitryss
Occasional Contributor

Re: Asynchronous Service

Hi Rupert,

 

thank you for a nice piece of advice! It helped me very much. I made it a little bit different, but the main approach is the same. Here is how I did it:

 

1.  I created a TestSuite with 3 TestCases

          0.png

 

2.  TestSuite was set up to execute all TestCases in parallel

          1.png

 

3.  Then each of MockResponses contains a TearDown Script

 

     For Callback TC:

testRunner.testCase.testSuite.getTestCaseByName("Fault").getTestStepByName("Fault").cancel()

     For Fault TC:

testRunner.testCase.testSuite.getTestCaseByName("Callback").getTestStepByName("Callback").cancel()

 

4.  And don't forget about timeouts for each.

 

Here is final result:

 

2.png

 

3.png

 

Kind Regards,

Eugene

View solution in original post

3 REPLIES 3
rupert_anderson
Valued Contributor

Re: Asynchronous Service

Hi Eugene,

 

How about:

 

1.Setup a TestSuite with 3 TestCases:

-(TC1) The first to make the request to the async service

-(TC2) Another for the first MockResponse TestStep to wait for the conf response

-(TC3) Another for the first MockResponse TestStep to wait for the fault response

2. In the first TestCase (TC1) use the Run TestCase TestStep to start TestCase (TC2) and another to start TestCase (TC3) setting the Run Mode to create isolated copy i.e. async. Also set the time out property on each Mock Response to something suitable so that the MockResponse that doesn't receive anything exits by itself.

 

Does this sound anything like what you need or even make sense? Basically by running multiple TestCases asynchronously only the one that doesn't receive the (conf or fault) response has to wait (until it times out).

 

Cheers,

Rupert

 

 

Author of SoapUI Cookbook
zitryss
Occasional Contributor

Re: Asynchronous Service

Hi Rupert,

 

thank you for a nice piece of advice! It helped me very much. I made it a little bit different, but the main approach is the same. Here is how I did it:

 

1.  I created a TestSuite with 3 TestCases

          0.png

 

2.  TestSuite was set up to execute all TestCases in parallel

          1.png

 

3.  Then each of MockResponses contains a TearDown Script

 

     For Callback TC:

testRunner.testCase.testSuite.getTestCaseByName("Fault").getTestStepByName("Fault").cancel()

     For Fault TC:

testRunner.testCase.testSuite.getTestCaseByName("Callback").getTestStepByName("Callback").cancel()

 

4.  And don't forget about timeouts for each.

 

Here is final result:

 

2.png

 

3.png

 

Kind Regards,

Eugene

View solution in original post

rupert_anderson
Valued Contributor

Re: Asynchronous Service

Hi Eugene,

 

Great! Pleased I could help! 

 

Nice one on the way you use the cancel method to stop the mock response TestStep from waiting, thats a neat refinement!

 

I also really like the way you communicate your question and solution i.e. good use of pictures! Have some kudos for that! 🙂

 

Cheers,

Rup

Author of SoapUI Cookbook
cancel
Showing results for 
Search instead for 
Did you mean: