如何在命令行中将参数传递给 SoapUI?
How to pass parameters to SoapUI in command line?
SoapUI 可以从 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
据说:
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.
所以我尝试使用:
... -Dusername=John
并在测试用例的代码中得到这个参数:
testRunner.testCase.testSuite.project.getPropertyValue("username")
但返回值为null
。知道如何在命令行中将参数传递给 SoapUI 吗?
参数应与-P
参数一起传递:
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.
和
P : Sets project property with name=value, e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2
并在测试用例的代码中得到这个参数:
ep = testRunner.testCase.testSuite.project.getPropertyValue("endpoint") // ep = "Value1"
-P 工作正常
sh testrunner.sh -Pproperty1=value1 -Pproperty2=value2
SoapUI 可以从 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
据说:
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.
所以我尝试使用:
... -Dusername=John
并在测试用例的代码中得到这个参数:
testRunner.testCase.testSuite.project.getPropertyValue("username")
但返回值为null
。知道如何在命令行中将参数传递给 SoapUI 吗?
参数应与-P
参数一起传递:
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.
和
P : Sets project property with name=value, e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2
并在测试用例的代码中得到这个参数:
ep = testRunner.testCase.testSuite.project.getPropertyValue("endpoint") // ep = "Value1"
-P 工作正常
sh testrunner.sh -Pproperty1=value1 -Pproperty2=value2