I want to load properties from property file as explained here http://www.soapui.org/Scripting-Properties/working-with-properties.html. I am using testrunner.sh to run the test.
I want to do something like ./testrunner.sh -PServiceEndPoint=${serviceendpointvalue} sample_soapuitest.xml but its not working.
serviceendpointvalue has been defined in properties.txt.
I modified JAVA_OPTS in testrunner.sh to include properties.txt.
Has someone tried this? Any sugesstions?
I think that parameters passed to testrunner.sh have to be defined prior to loading properties from a file.
I am 99% sure that you can accomplish what you want in another way, though.
Parameterize the endpoints in your requests. If this is a lot of work, I’d suggest using search and replace in a text editor. I’ve done it before and it worked. You just have to look out for other places the service endpoint might show up (such as in WSDL/WADL/XSD references, etc.)
What you want for your endpoints in the requests depends upon whether you are using SOAP or REST.
I forget why it has to be different, but it was a pain to figure out.
In the properties fields, the data would look like:
You can set these properties using a file. The file will be parsed as execution starts, and the requests will use the property values from the file.
Edited on 07/30/12
You can still use the approach that I mentioned.
This command line runs my sample test specifying the test.props file. That file has just this in it:
test=1234
(it is output by export properties)
My project has the project property called test set to another value besides 1234.
ndfdXML is my project name.. just a sample name.
COMMAND LINE:
C:\Program Files\SmartBear\soapUI-4.5.1\bin>testrunner.bat -Dsoapui.properties.ndfdXML=test.props ndfdXML-soapui-project.xml
That last line is output by this groovy:
log.info(context.expand(‘${#Project#test}’))