Forum Discussion

GAcharya's avatar
GAcharya
Occasional Contributor
4 years ago

SoapUI-How to pass Environment variable from cmdSoapUI-How to pass Environment variable from cmd

SoapUI-How to pass Environment variable from cmd

 

Hi Team ...I want to pass a variable while running from command prompt like the env variable or a property file..

Help me with some hacks or alternatives.

The main aim is to run my project with diff env where i kept the 3 env properties file outside.

I want to run this in only SOAPUI from jenkins.

3 Replies

  • richie's avatar
    richie
    Community Hero
    Hey,

    I'm also interested in this too. I also have environmental properties files that i currently repoint by opening soapui, checkout, import the properties (to switch environments), then check back in to apply the environmental repoint.

    I don't know how else to manage this....

    Cheers,

    Rich
  • ZDGN's avatar
    ZDGN
    Contributor

    Hi GAcharya 

     

    If you only want to pass a variable to SoapUI using the command line (aka testrunner), you can easily use one of those option for example:

    • D : Sets system property with name=value
    • G : Sets global property with name=value
    • P : Sets project property with name=value, e.g. -Pendpoint=Value1 -PsomeOtherProperty=value2

    You can find more info here: https://www.soapui.org/docs/test-automation/running-functional-tests/

    Another way could be to create different "soapui-settings.xml" files including some specific global properties, and set the file to use with this option:

    • t : Sets the soapui-settings.xml file to use, required if you have custom proxy, ssl, http, etc setting

     

    In case you want more, like using a properties file, I suggest using some kind of "Setup Script" to load your custom properties. But you'll have to duplicate the script into each TestSuite or TestCase depending on your usage.

     

    Let me know if it can help.