Forum Discussion

dan2014's avatar
dan2014
Occasional Contributor
10 years ago

Is it possible to parameterize the user credentials in the soapui free version ?

Hi,

 

I am using the soapui free version. I need to run my tests with different credentials by giving different endpoints for dev and staging. Is it possible to parameterize this in the free version or we need to buy the pro version to achieve this?

 

Regards,

Daniel

  • Hi Daniel,

     

    Yes, although the pro version does have the environment feature, this is very doable in the open source version, there are several effective ways to accomplish this.

     

    One way is to use a Properties TestStep. These can be used to load properties from a simple text file as part of a TestCase e.g. a file containing:

     

    environmentName=QA Environment
    invoiceEndpoint=http://localhost:9001
    userName=test
    password=password

     

    These properties can then be referenced eslewhere in the TestCase e.g. to set Request TestStep properties/value using property expansions e.g. like 

     

    def environmentName = context.expand('${LoadProperties#environmentName}')

     

    Note you can also supply the file name as a property that could be supplied as a project level property e.g. reference with ${#Project#propertiesFileName}

     

     

    Also as a runtime parameter (-PpropertiesFileName=...) if running SoapUI from a runner script e.g. testrunner.sh. Note you could supply all your properties this way, there is also a -e enpoint parameter for the runner script.

     

    See also http://www.soapui.org/scripting---properties/working-with-properties.html

     

    Hope this gives you some ideas,

     

    Cheers,

    Rupert

     

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi Daniel,

     

    Yes, although the pro version does have the environment feature, this is very doable in the open source version, there are several effective ways to accomplish this.

     

    One way is to use a Properties TestStep. These can be used to load properties from a simple text file as part of a TestCase e.g. a file containing:

     

    environmentName=QA Environment
    invoiceEndpoint=http://localhost:9001
    userName=test
    password=password

     

    These properties can then be referenced eslewhere in the TestCase e.g. to set Request TestStep properties/value using property expansions e.g. like 

     

    def environmentName = context.expand('${LoadProperties#environmentName}')

     

    Note you can also supply the file name as a property that could be supplied as a project level property e.g. reference with ${#Project#propertiesFileName}

     

     

    Also as a runtime parameter (-PpropertiesFileName=...) if running SoapUI from a runner script e.g. testrunner.sh. Note you could supply all your properties this way, there is also a -e enpoint parameter for the runner script.

     

    See also http://www.soapui.org/scripting---properties/working-with-properties.html

     

    Hope this gives you some ideas,

     

    Cheers,

    Rupert

     

    • dan2014's avatar
      dan2014
      Occasional Contributor

      Thank u so much Rupert :-)

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi Dan,

         

        No problem, very happy to help! :-)

        Did this fix your problem?

         

        Cheers,

        Rupert