Forum Discussion

Brian_Mowbray's avatar
Brian_Mowbray
Contributor
15 years ago

Passing properties to the test project via the command line runner

If I kick off a test using the command line runner (i.e. loadtestrunner.bat), the documentation [http://www.soapui.org/userguide/commandline/loadtestrunner.html] indicates that I can set a project property using the -P parameter.

I did the following:
"C:\Program Files (x86)\eviware\soapUI-Pro-3.0.1\bin\loadtestrunner.bat" LoadTestWithLightWeightAdapterComponents.xml -n1 -m10 -r -fResults -Ppropertyname=value

I would think I should be able to read the property using this syntax:
log.info("read commandline value = " + project.getPropertyValue("propertyname") );

But my log indicates that the value is null:
2010-04-08 11:52:59,197 INFO  [log] read commandline value = null

Is my thinking correct on how to use this?  Something that I am missing?

8 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Brian,

    are you using the 3.0.1 release or an updated nightly build? (i think this may have been a bug in the initial version..)

    regards!

    /Ole
    eviware.com
  • I just tried on 3.5 as well, same issue.

    "C:\Program Files (x86)\eviware\soapUI-Pro-3.5\bin\loadtestrunner.bat" -sDocQueryLoadTestSuite -cDocQuery-ThreeDocuments -n1 -m10 -r -fResults -Pk1=v1 -Pk2=v2 C:\Projects\nhinc\Current\Product\IntegrationTest\PerformanceTest\LoadTestWithLightWeightAdapterComponents.xml
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    try this syntax instead

    log.info("read commandline value = " +context.expand( '${#Project#k1}' ));

    let us know does it help

    regards
    nebojsa
    eviware.com
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    hmm.. from what script are you trying to read these values ?

    regards!

    /Ole
    eviware.com
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Brian,

    ok, that explains it; these properties are available first after the project has been loaded, which is too late in your case as the project setup script executes before they are assigned. Maybe you can use global properties instead (with the -G option) which are assigned before the project is loaded?

    regards!

    /Ole
    eviware.com