Ivan Gerasimenko
Ivan Gerasimenko

Reputation: 2428

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?

Upvotes: 2

Views: 2940

Answers (2)

Lipsa Das
Lipsa Das

Reputation: 9

-P works fine

sh testrunner.sh -Pproperty1=value1 -Pproperty2=value2

Upvotes: 0

Ivan Gerasimenko
Ivan Gerasimenko

Reputation: 2428

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"

Upvotes: 2

Related Questions