Forum Discussion

axasmgaxa's avatar
axasmgaxa
Occasional Contributor
6 years ago

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.

  • sonya_m's avatar
    sonya_m
    6 years ago

    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. 

  • richie's avatar
    richie
    Community Hero
    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
    • axasmgaxa's avatar
      axasmgaxa
      Occasional Contributor

      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.

       

       

  • nmrao's avatar
    nmrao
    Champion Level 3

    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

     

     

     

    • axasmgaxa's avatar
      axasmgaxa
      Occasional Contributor

      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's avatar
        richie
        Community Hero
        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