Forum Discussion

nefsir's avatar
nefsir
New Contributor
8 years ago

How to pass parameter from current test case to mock service?

Hi!

 

I would like to change response timeout of multiple mock services based on parameters passed from test case.

I've tried a lot of different approaches but unfortunately without success...

 

Does anyone has any ideas?

4 Replies

    • nefsir's avatar
      nefsir
      New Contributor

      Yes, that's one way for sure but I issue request from SoapUI to SUT and SUT is sending request to MockService.
      I can't add anything in this SUT -> MockService request...

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        Not sure what you mean by that. As long as it is part of header, the mocker service should be able read the same. It was not just limited for SoapUI. May be you want to clarify otherwise.
  • KarelHusa's avatar
    KarelHusa
    Champion Level 3

    I use some of the elements of the request to carry the testing information.

     

    Especially if different mock services share a same set of XML elements, than all of them are handled with the same Groovy script.

     

    The groovy script does the work: parses the request message, reads the information with XPath and does what required (chooses the response message, populates some values, sets HTTP headers, waits a specific delay etc.).

     

    Karel