Forum Discussion

nmrao's avatar
nmrao
Champion Level 3
12 years ago

Hitting multiple endpoints with Groovy

Hi,

I do have similar problem, runner is not being identified in setup script.

If i understand your problem correct, it is required to run the same set of tests against multiple endpoints (believing that against different host/ports) automatically using soapui. If this is the case, you may try using $SOAPUI_HOME/bin/testrunner.sh where it allows you to pass a parameter value for endpoint and call testrunner multiple times with different end points. This has also options to generate reports which may be interesting to you.

Alternatively, you can achieve the same thing by using ant build script if you are familiar with ant - define a macrodef(like a function) with end point as an argument which does the running of test runner. And define number of targets which calls marodef by passing the actual value for endpoint. Along with it use ant task junitreport which will show nice html reports.

Another way by using groovy:

In your project, go to service interface, change the endpoint to use project properties. For eg if your endpoint is

http://server1.com/service

, change to ${#Project#EndPoint} and assign to all tests.

In the groovy, define a list with all your exact endpoints
say


def endPointList = ['http://server1.com/service', 'http://server2.com/service']
endPointList.each { ep ->
project.setProperty('EndPoint', ep)
//add other stuff like running your suites here, the link may help you here http://www.soapui.org/forum/viewtopic.php?f=14&t=17153
} //this will loop thru your endpoints



Hope this will be of help.

Regards,
Rao.

  • nmrao's avatar
    nmrao
    Champion Level 3
    A typo in previous reply. Please read ${Project#EndPoint} as ${#Project#EndPoint}
    Saw your response, need to look into details of the code snippet you had added.

    Regards,
    Rao.