Forum Discussion

amirse's avatar
amirse
Contributor
7 years ago

Get data from previous step in virtual service (mock)

Hi,
I have a GET REST service "https://intracomp.se/v1/state/${Properties 1#agreementId}/${StateDate#result}/tree". As you can see the service uses some properties from the previous test steps.
My question is how can I (if possible) achive this when I use virtual service. I am still running the whole test case and I would like to, depending on the value of the propertie from previous step, return different JSON messages.
But If I only can start a listener on http://localhost:8080 and not add any parameters after that then I can not differentiate the request.

I.e. I would like to write "http://localhost:8080/v1/state/${Properties 1#agreementId}/${StateDate#result}/tree". But I cannot get this to work.

  • Hi,

     

    If I got your question right, you are using SoapUI for testing and would like that some request(s) are processed by ServiceV but not by the real server.

    If the above understanding is correct, then I can think of two options:

    a) Change the endpoint address for the required request so that SoapUI send it to the ServiceV instead of the real server;

    b) If for some reason the above is not possible, you may consider using the conditional routing functionality of ServiceV - https://support.smartbear.com/readyapi/docs/servicev/routing/conditional.html

     

    Does this help?

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    If I got your question right, you are using SoapUI for testing and would like that some request(s) are processed by ServiceV but not by the real server.

    If the above understanding is correct, then I can think of two options:

    a) Change the endpoint address for the required request so that SoapUI send it to the ServiceV instead of the real server;

    b) If for some reason the above is not possible, you may consider using the conditional routing functionality of ServiceV - https://support.smartbear.com/readyapi/docs/servicev/routing/conditional.html

     

    Does this help?

     

    • amirse's avatar
      amirse
      Contributor

      Thanks Alex,
      Solution a) wokred.
      A bit strange since I did test this but It must have been something else that was wrong at that time as well so it did not work. But sure it works. Thank you