'How to pass parameters to SoapUI in command line?
SoapUI could be started from command line with some set of parameters:
testrunner.bat -FPDF -R"JUnit-Style HTML Report" -c"my test case" c:\my projects\my-project.xml
And it is stated that:
D : Specifies a value of a system property for the test run. The specified value will override the variable's value during the run. Usage:
-D=
. If the value includes spaces, enclose the entire argument in quotes. To override several variable values, specify the -D argument several times.
So I tried to use:
... -Dusername=John
And get this parameter in the code of test case:
testRunner.testCase.testSuite.project.getPropertyValue("username")
But the returned value is null
. Any ideas how to pass parameters to SoapUI in command line?
Solution 1:[1]
Parameter should be passed with -P
param:
P : Specifies a value of a project property for the test run. The specified value will override the variable's value during the run. Usage:
-P<variable>=<value>
. If the value includes spaces, enclose the entire argument in quotes. To override several variable values, specify the-P
argument several times.
And
P : Sets project property with name=value, e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2
And get this parameter in the code of test case:
ep = testRunner.testCase.testSuite.project.getPropertyValue("endpoint") // ep = "Value1"
Solution 2:[2]
-P works fine
sh testrunner.sh -Pproperty1=value1 -Pproperty2=value2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ivan Gerasimenko |
Solution 2 | Lipsa Das |