Forum Discussion

nesharma's avatar
nesharma
New Contributor
10 years ago

How to set SoapUI project properties via Maven command line

I have a few project properies in SoapUI project. I also have those project properties overridden in Maven pom.xml, for eg.

 

...

<projectProperties>

    <value>propname1=propvalue1</value>

    <value>propname2=propvalue2</value>

    ...

    <value>propname9=propvalue9</value>

</projectProperties>

 

When running from command line using maven, SoapUI property values are overridden by the ones in Maven pom.xml, as expected.

 

I need to run SoapUI from command line using Maven but need to use the properties specified in SoapUI project, not Maven. Is there any way to specify these properties in Maven command line? If not, is there any other solution?

 

Versions:

SoapUI Pro 5.1.2

maven-soapui-pro-plugin 4.5.1

 

I also found a related post (http://forum.soapui.org/viewtopic.php?t=20839) and tried to use the flag -Dsoapui.projectProperties but have not been successful. Since exact syntax is not specified in the post, I tried many variations For eg: -

-Dsoapui.projectProperties.propname1.value="propvalue1"

-Dsoapui.projectProperties.proname1="propvalue1"

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,

     

    Please refer to this page explaining some tips you can find useful. Pay special attention to the Configuring properties from external file section. 

    • nesharma's avatar
      nesharma
      New Contributor

      Thanks Tanya. I tried the instructions in the page you provided and in other posts which are referenced and also tried many tweaks but have been unsuccessful.

       

      The command line options specified on this page are not for Maven command line. They are for SoapUI testrunner .bat/.sh which I am not using. Should these apply to Maven command line as well?

       

      Here is what my pom file looks like currently:

       

      <configuration>

                  <projectFile>${TestFile}</projectFile>

                    <testSuite>${TestSuite}</testSuite>

                     <testCase>${TestCase}</testCase>

                     <endpoint>${EndPoint}</endpoint>

                     <testExecution>${TestExecution}</testExecution>

                      <outputFolder>target/surefire-reports</outputFolder>

                      <junitReport>true</junitReport>

                      <exportwAll>true</exportwAll>

                      <printReport>true</printReport>

                      <testFailIgnore>true</testFailIgnore>

                       <projectProperties>

                                                     <value>propname1=propvalue:1</value>

                                                     <value>propname2=propvalue:2</value>

                                                      …

                                                     <value>propnameN=propvalue:N</value>

                       </projectProperties>

      </configuration>

       

      I have tried commenting out <projectProperties> block and added below instead:

      <soapuiProperties>
          <property>
            <name>soapui.properties</name>
            <value>test.properties</value>
          </property>
        </soapuiProperties>

       

      Created "test.properties" file in same path. Also, tried by providing full path of test.properties file.

       

      I have tried several other variations like providing property value from maven command line like so:

       

      pom.xml:

      ...

      <soapuiProperties>
          <property>
            <name>soapui.properties</name>
            <value>${PropFile}</value>
          </property>

      </soapuiProperties>

       

      Maven command line: 

      mvn eviware:maven-soapui-pro-plugin:test -DTestFile=soapui-project.xml -DPropFile=test.properties

       

      My property values contain colons so I  have also tried after escaping them in test.properties. I have given full permission for test.properties to all. I am running on Linux.

       

      I have also tried using <globalProperties> because that will work in my case as well.

       

      In every case, it is not loading properties from test.properties file, it is loading from SoapUI. If I uncomment <projectProperties>, then those are loaded.


       

       

  • Heena_Sharma's avatar
    Heena_Sharma
    Occasional Visitor

    Project properties can be configured using command line as below:

    Add the following snippet to your pom

     

    <projectProperties>
    <value>Env=${soapUiEnv}</value>
    </projectProperties>

     

    Where 'Env' is the Project property name that would be set in SOAP UI project and '${soapUiEnv}' is the value that will be passed using maven test parameter as below:

     

    com.smartbear.soapui:soapui-pro-maven-plugin:test -DsoapUiEnv=qa

     

    This will create a project property named "Env" with value "qa" in your soap ui project.