question

ssharath avatar image
ssharath asked nmahesh answered

How to use a web service at two different instances in a single test case

Hi All, I've been using a web service in same test case at two different instance one at the beginning of the test case and next at the end of the test case. Here, I'm facing a problem when I call the web service which is at the beginning of the test case is works properly i.e it will retrieve the info if it is available in DB. But, the second instance is not working as expected even thought the service is available in the Database it is failing to retrieve it throwing an message 'no services available' etc. Moreover, my observation showed that if I run the test case without any break point the second web service instance is failing to retrieve. But, if I toggle a break point an iterate through the second web service instance it is doing the job i.e retrieving the service. So, my question here is that can't we use same web service at two different instance in a single test case. if the above explanation is not clear below are the detailed steps. We have a web service called retrieveService. 1. Beginning of the test case I've used the web service to retrieve all the services from the DB. 2. Then, it goes all the way to the business logic. . . . 3. then after the business logic execution is complete then again I'm writing a step using the same web service and trying to retrieve all the services. When I call the web service again at step3 even if services are present the step is failing to retrieve. But, when tried by parking a break point it was retrieving the service. Could any one please help me on this. Is it not legal in itest to use same step at two different place in single TC. if its legal then how to achieve it. And, one more query regarding web services. say Im iteration a web services in a forloop for 10 times so can we store response of all the 10 calls in a single response map. To my understanding response map will store only the latest info. Here, my requirement it that I need to compare the response's of all the web services calls with another response map and based on that comparison I'll be confirming whether TC is pass or fail. Thank you all in advance.
iTestweb services
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
nmahesh avatar image
nmahesh answered
It looks like step-1 is taking little more time to retrieve the response, so could you please try by adding 'sleep' for 10 to 20secs after the first step. If I am wrong, please provide a test report in .fftz format for better understanding. And regarding your second query, even the number of iterations of a command are more however the command response is same irrespective of values, we could use a single response map. Attached a sample testcase, session profile and response map for your reference. [link text][1] [1]: /storage/temp/4715-sample_response.rar

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.