Loop Test to Run same test against 3 different endpoints
is it possible to loop a test so that it fires a request against different end points?
I was hoping to fire a test against an endpoint, write out the response to excel;
loop again, run the same test against a new endpoint, write out the response and repeat.
I have searched around this community and google, and I can't seem to find an explanation that helps me with this scenario.
Any help would be greatly appreciated.
Thanks in advance for the help.
Solved! Go to Solution.
If you create a test with the following object hierarchy, will this not satisfy what you need?
REST Request (endpoint1)
REST Request (endpoint2)
REST Request (endpoint 3)
Wouldnt the above testcase satisfy what you need?
If you are automating the tests, then the below approach should work well.
- Use project level custom property for endpoint's host & port.
- Invoke tests command line using test runner and pass endpoing details as command line options
- Repeat the same for other endpoints
- Of course, you may also use different environment each time test is invoked via command line options (never used this approach through )
Refer document for invoking tests command line
Thanks @richie for the reply,
this was potentially the best solution, except SoapUI/ReadyAPI really doesn't like more than one datasink in one test case.
I set it up as you had described, but only the last datasink outputs data to the excel sheet. (I think that might be a bug with Soap?)
I tested it also, I deleted any two of the data sinks and the remaining datasink output data to the sheet.
The same happened when any of the data sinks were left.
Many Thanks for the response all the same.
thanks @nmrao ,
I am setting these tests up for another team; so using the UI was the hope, as they may want to maintain/amend the tests and wouldn't be experienced with code.
I've only ever used datasinks once or twice before so apologies if i've steered you on the wrong track.
Im wondering if the problem isnt that you cant have multiple datasinks in a testcase, im wondering if your datasink entries are overwriting and this is the reason hindering you having more than 1 datasink in a testcase.
I dont know if this would work for the scenario you need, but have you tried writing to 3 different datasink files? So datasink1 (for endpoint1) writes to datasink1.txt, datasink2 (for endpoint2) writes to datasink2.txt and so on and so on?
Im pretty sure this would work....although i dont know if its acceptable for you to have different datasink files for what you need.
Csn you confirm the purpose od these datasinks? The reason i'm asking is that i use a different method to capture all my output. I use a TestRunListener.afterStep eventhandler to record all my input and output. It records everything so it might record a bit too much for you, but i use this method to capture my testevidence and is perfect for this?
- Using the command line should not difficult
@nmrao I had a look at your response a little more in depth, and I agree that there is much less coding involved than I initially thought; if any.
There is still seemingly no way to loop the cases on the endpoint this way; as in run the same test case each time against 3 endpoints, then move onto the next testcase?
I will look into the command line in the future for running my tests, however, I am setting up these tests for someone who may only be comfortable with "point and click", so I have to keep it as simple as possible.
Thanks for your help on the matter, you have helped me in the past as well and I appreciate it!
Each time the test execution is done for all the tests. This is how complete automation is achieved. Of course, it is possible to invoke a single test as well.
I am talking about executing the tests without human intervention. But you are talking about manual execution.
I have done a good bit of research on this one @richie
the datasinks work if you use different excel sheets for each one; but that is no use to me unfortunately
they are relatively simple tests.
- 1. data source - read in a date
- 2 .soap request xml - (uses date above)
- 3. response - extract two values from the response
- 4. data sink - output the response values to two specific columns in an excel sheet
I had initially hoped, that I could loop this test, and run it against a few endpoints, so that I would get 2 values output from each test.
Then, you had suggested setting up the requests individually (your first message).
However, the issue with the datasinks meant it would only output the last value extracted.
Do you know is there somewhere I can log that as a bug/defect?