Forum Discussion

Magnus's avatar
Magnus
Occasional Contributor
17 years ago

MockResponses listening on different ports in a Load Test

Hi,

How can I achieve so that asynchronous requests that are received by Test Case instances in a Load Test is routed to the right test case instance? The test case consists for example of two steps. One request that is sent to the testing object. The testing object will responde to this request asynchronous at any time. The other step in the test case is a MockResponse that reveives the asynchronous request.

This works just fine if all the requests in the Load Test are executed sequentially. But if they are executed concurrently "which they usually are in a load test" the asynchronous request could reach any test case instance since the MockResponse in all test cases are listening to the same port.

How can this be solved? We tried to use a variable when defining the port in the MockResponse. But it was not possible. Any other suggestions?

Regards,
Magnus     

7 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Magnus,

    thanks for you post.. currently MockResponse steps are synchronized during loadtests.. so the one that "listens first", gets the first request. Unfortunately I don't really know how we could achieve this with the current implementation.

    Your idea with different ports is good.. also we could have some configurable identifier in the incoming request that is used to "select" the corresponding loadtest-thread via a property or something.. (for exmple a session-id).. does that sound viable?

    any other ideas are very welcome!

    regards!

    /Ole
    eviware.com
  • Magnus's avatar
    Magnus
    Occasional Contributor
    Thanks for your answer!

    The idea with the session id I think is good if it could be implemented in the following way. Two new "variables" are introduced and associated with a Mock Response. One that contains the id (session id) and one that contains an XPath statement. When the thread that is responsible of receiving "asynchronous" requests receives a request, it uses the XPath statement to extract the id (session id) from any XML element or property that was received in the request and then dispatches the request to the MockResponse with the same id.

    It is important that the id in the MockResponse can be set by using the step type Property Transfer.

    This feature would be very good to have (is a must I would say) when load testing applications that are using the publish/subscribe mechanism or any applications that are sending out asynchronous events.   

    /Magnus
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Magnus,

    thanks for you feedback!

    yes.. this is in the line of my thinking as well :-) I definitely agree that this must be fixed to be able to load-test asynchronous applications.. unfortunately this won't make it into soapUI Pro 2.0, but well in the version after that..

    sorry for any inconvenience..

    regards!

    /Ole
    eviware.com
  • Magnus's avatar
    Magnus
    Occasional Contributor
    Hi Ole!

    That sounds great 

    We really need this feature to be able to use soapui Pro to system test the web services application in our project.

    When have you planned for the next release? The one after 2.0.

    Regards,
    Magnus 
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Magnus,

    we try to release a new version about every 3 months, but there will be intermediate snapshots so this would probably be in one of these.. I'll let you know !

    /Ole
    eviware.com
  • mermet's avatar
    mermet
    Occasional Contributor
    Hi, I have also a similar requirement, as my Test Cases all use Mock Responses (asynchroneous Notification Process).

    I have seen that the MockService Runner is accepting a port option. Could possibly the MockResponse listening Port be configured to be unique for each LoadTest Thread ?

    This unique port value would need to be generated / known earlier in the Test Case in order to:

    1) Tell the target Application on which port to invoke the Mock Response for that Thread

    2) Start the Mock Response on that port value for current Thread.


    Ultimately, as the Mock Responses are listening on different port numbers, there will be no need for Mock Responses to be synchronized.

    Regards.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi mermet,

    thanks.. you could use a groovy-script before the MockResponse step to change the port.. but unfortunately the MockResponse step won't detect this to run unsynchronized.. we could add a "Synchronize during loadtest" option (default = true), which you could turned off if "you know what you are doing".. ?

    whaddayathink?

    regards,

    /Ole
    eviware.com