Forum Discussion

Glenn_Halstead's avatar
Glenn_Halstead
Occasional Contributor
16 years ago

Set Mock response from groovy script that talks to JMS?

Hi Folks,

I'm new to SoapUI and am not a java guy (yet).  I'm picking up some work from one of our test teams to bring the testing into our BAU test environment.

We use JMS and the guy who developed the tests has used a groovy step in the test cases to send the response to MQ and get the response back.  The response can then be programatically checked in the groovy step.

I want to get the response back into SoapUI world so I can use SoapUI TestRequest assertions rather than java assertions.  This is valuable to me as I intent to use Hudson to run the SoapUI test cases and parse their output to update our live web reporter tool.  I'd rather have standard SoapUI output rather than java stack traces.

I tried to take the code from the groovy test step and put it into the MockService but I get a problem with the very first command (import com.sky.mq.java.MQManager) which works fine in the groovy test step.  Is the mock groovy scope more limited that the test step groovy scope?

I'm thinking I could put the response into a testsuite / project / global property and expand that property in the mock response but can't see how to set a global property.

sooo.... lots of ideas, not much knowledge at this stage.  Can anyone help?

thanks

Glenn

3 Replies

  • Glenn_Halstead's avatar
    Glenn_Halstead
    Occasional Contributor
    Replying to my own thread... should I be concerned that I'm always doing this?

    Anyway...
    1. I moved the Groovy step to be before the Request step. 
    2. I put the response from the groovy JMS request in a Project property.
    3. I make the mock return the value of the Project property.

    Now the Request step gets the real JMS response from it's mock.
  • Michael_McDonal's avatar
    Michael_McDonal
    Occasional Contributor
    No answers for you but interesting as I posted a similar question a few days after you. I need to to DB validation after interacting with a WS and I would like to have a test step that could use JDBC as a resource and be able to use the standard request assertions against the result set.