cancel
Showing results for 
Search instead for 
Did you mean: 

Loop Test to Run same test against 3 different endpoints

SOLVED
axasmgaxa
Occasional Contributor

Loop Test to Run same test against 3 different endpoints

Hi folks,

 

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.

Steven.

1 ACCEPTED SOLUTION

Accepted Solutions
sonya_m
Community Manager

Re: Loop Test to Run same test against 3 different endpoints

nmrao, richie, thank you for the input. 

 

@axasmgaxa , it would be great if you could contact support and explain what behavior you would expect with DataSink, they’ll create a bug if needed. We will be waiting for the results. Thank you. 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

11 REPLIES 11
richie
Community Hero

Re: Loop Test to Run same test against 3 different endpoints

Hey @axasmgaxa,

If you create a test with the following object hierarchy, will this not satisfy what you need?

Datasource
REST Request (endpoint1)
DataSink
REST Request (endpoint2)
DataSink
REST Request (endpoint 3)
DataSink
Datasource Loop

Wouldnt the above testcase satisfy what you need?

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
nmrao
Community Hero

Re: Loop Test to Run same test against 3 different endpoints

@axasmgaxa ,

 

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

https://support.smartbear.com/readyapi/docs/soapui/running/automating/cli.html

 

 

 



Regards,
Rao.
axasmgaxa
Occasional Contributor

Re: Loop Test to Run same test against 3 different endpoints

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.

 

 

axasmgaxa
Occasional Contributor

Re: Loop Test to Run same test against 3 different endpoints

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.

 

Kind Regards,

Steven.

richie
Community Hero

Re: Loop Test to Run same test against 3 different endpoints

Hey @axasmgaxa

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?

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
nmrao
Community Hero

Re: Loop Test to Run same test against 3 different endpoints

- There is nothing code related in the reply.
- Using the command line should not difficult


Regards,
Rao.
axasmgaxa
Occasional Contributor

Re: Loop Test to Run same test against 3 different endpoints

@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!

 

 

nmrao
Community Hero

Re: Loop Test to Run same test against 3 different endpoints

As mentioned earlier response, it is possible to override the endpoint from command line.
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.


Regards,
Rao.
axasmgaxa
Occasional Contributor

Re: Loop Test to Run same test against 3 different endpoints

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 Smiley Sad

 

they are relatively simple tests.

  1. 1. data source - read in a date
  2. 2 .soap request xml - (uses date above)
  3. 3. response - extract two values from the response
  4. 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?

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors