Ask a Question

Project Load Script executed before the command line arguments are used.

Occasional Contributor

Project Load Script executed before the command line arguments are used.


I`m using the option to execute the soapUI project from command line and using the P argument to pass project level properites.



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.

<End Quote>


In the Project Load Script I want to load project level properties from previously saved property file using the ENV_NAME property which is passed in the command line arguments.

The problem that I`ve encountered is that the Project Load Script is executed before the argument from the command line is used to set the ENV_NAME property. As a work around I have added a new testSuite which will run the script instead of the Project Script.

But this seems patchy and also reflects in the test report.

Can someone explain the logic why to run the Project Load Script before the command line arguments were used?

Is there some other way to pass an argument to the project which can be used in the Project Load Script?


Community Hero

Seems you could do some creative workaround, such as:



echo ENV123 > C:\env_name.txt
testrunner "myproject.xml"

Project Load Script:

project.setPropertyValue( "ENV_NAME", new file("C:/env_name.txt").text )
assert project.getPropertyValue("ENV_NAME") = "ENV123"


I could have some typo since I haven't run this, but just to give you an idea...

Community Hero

Another way to override the properties is to use a property file, change the values as needed for the current test, and pass it for testRunner utility as system argument such as :"/path/to/"

Occasional Contributor

Thanks for the input.

Used the file solution.

Occasional Contributor

In another post I raised, a better solution was provided.

In short, the project properites are set from the command line after project load scirpt is executed.

But the system properties are set before.

So they can be used.


testrunner.bas <options to execute the project> -DIS_INVOKED_COMMANDLINE=true

if ('true' == System.getProperty('IS_INVOKED_COMMANDLINE')) {
//You business logic here


Showing results for 
Search instead for 
Did you mean: