Forum Discussion

Marshall's avatar
Marshall
Occasional Contributor
11 years ago

Scripting Mock Response's port number

SmartBear/Support Community,

I have a question and am optimistic that someone will be able to shed some light on the answer.

First a description of my testing scenario:
In my testing using soapUI, I have a workflow consisting of multiple SOAP test step requests to the same endpoint. After each request, there is a subsequent Mock Response test step which waits for an asynchronous response from the aforementioned endpoint. This async response notifies my soapUI client when the previous request has succeeded so the flow can progress to the next step. These async responses are very important because each step depends on the one before it to have completed successfully before executing itself and the time each step takes to complete varies depending on the request.

This process works great when using one thread, however when performing stress testing with multiple threads I have encountered an issue. Each thread runs through the workflow with its own unique dataset, and thus, each Mock Response requires its own unique port number to listen for the async response on. Each thread receives its dataset/values through a combination of DataGen and Groovy Script test steps. However, I have been unable to find a way to script the Port number on which the Mock Response test step listens. Is there a way to do this?

My question is: How can I script the Port number on which a Mock Response test step listens. Is there a way to do this?

Here is a screen capture of the field I am trying to change in my script:



I am running:
Software Version: soapUI Pro 4.5.2
Build Date: 20130522-1354

Thank you all in advance for your time and expertise!

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello Marshall,

    I believe you could accomplish this using custom properties.
    Define a custom property say mockResponsePort in your MockResponse and bind the port to that property using property expansion. #TestCase

    A usefull example can be found below:
    http://www.soapui.org/Functional-Testin ... d-endpoint

    And on property expansion in general and at what levels it can be defined:
    http://www.soapui.org/Scripting-Propert ... nsion.html

    In turn you should then be able to change that property based on each request to prepare it for the next one.
    Does that answer your question, or am i far off here?

    Do get back to us should you run into any further problems with implementing it.

    Best regards,
    Mikael
    SmartBear Support
  • Marshall's avatar
    Marshall
    Occasional Contributor
    Mikael,

    Thanks for looking into my question!

    When I try to set the "Port" property of a MockResponse test step to a custom property value such as "${#TestCase#RESPONSEADDR}", it does not seem to be allowed. When I enter the variable text and click out of the field, the text changes to "0". Please see the screen captures below for a depiction of what I am describing:





    Please let me know if I am doing this wrong or if there is another way scripting the Mock Response's port number can be accomplished.
    Regards,
    Marshall
    • jpr's avatar
      jpr
      Occasional Contributor

      Hi, did you find a happen to find workaround for this? I have the same issue.

       

      Kind regards,

      Jimmy