djangofan
12 years agoContributor
Specific question about passing -P or -G args to SoapUI
I have a specific question about passing -G or -P args to a SoapUI testrunner.bat script.
If I add this to my command line: -PpHost=pHost:5555 or -GgHost=gHost:4444 and I want a Groovy script within my SoapUI test to access this variable, how can I do that? How can I get a .groovy script to access a Global property? I could make it work with "a hack and a temp file" but I would rather not if there is a correct way of doing this.
I setup a test and I cannot get it to work. I only get "null" when passing arguments. Here is my batch script:
Here is my .groovy script:
And here is the result:
If I add this to my command line: -PpHost=pHost:5555 or -GgHost=gHost:4444 and I want a Groovy script within my SoapUI test to access this variable, how can I do that? How can I get a .groovy script to access a Global property? I could make it work with "a hack and a temp file" but I would rather not if there is a correct way of doing this.
I setup a test and I cannot get it to work. I only get "null" when passing arguments. Here is my batch script:
@ECHO off
SET COMMAND_STRING=-GgHost=ghost:5555 -PpHost=phost:4444^
-h^"localhost:5666^" -s^"TestSuite1^" -c^"TestCase1^" -r -a -j -I^
-f^"junit-results^" ^"TestArgs.xml^"
ECHO cmd.exe /c %SOAPUI_HOME%\bin\testrunner.bat %COMMAND_STRING%
ECHO Running...
cmd.exe /c %SOAPUI_HOME%\bin\testrunner.bat %COMMAND_STRING%
pause
Here is my .groovy script:
def env = System.getenv()
String phost = env['pHost']
println "pHost=" + phost
String ghost = env['gHost']
println "gHost=" + ghost
And here is the result:
cmd.exe /c C:\soapUI-4.5.1\bin\testrunner.bat -GgHost=ghost:5555 -PpHost=phost:4444 -h"pdxsasqa069:6500" -s"TestSuite1" -c"TestCase1" -r -a -j -I -f"junit-
results" "TestArgs.xml"
Running...
soapUI 4.5.1 TestCase Runner
[main] INFO com.eviware.soapui.tools.SoapUITestCaseRunner - Setting global property [gHost] to [ghost:5555]
[SoapUI] Adding [C:\soapUI-4.5.1\bin\ext\ojdbc6.jar] to extensions classpath
[DefaultSoapUICore] initialized soapui-settings from [C:\Users\u0163410\soapui-settings.xml]
[WsdlProject] Loaded project from [file:/C:/Temp/TestArgs.xml]
[SoapUITestCaseRunner] Setting project property [pHost] to [phost:4444]
[SoapUITestCaseRunner] Running soapUI tests in project [TestArgs]
[SoapUITestCaseRunner] Running TestCase [TestCase1]
[SoapUITestCaseRunner] Running soapUI testcase [TestCase1]
[SoapUITestCaseRunner] running step [Groovy Script]
pHost=null
gHost=null
[SoapUITestCaseRunner] Finished running soapUI testcase [TestCase1], time taken: 318ms, status: FINISHED
[SoapUITestCaseRunner] TestCase [TestCase1] finished with status [FINISHED] in 318ms