Forum Discussion

ipstefan's avatar
ipstefan
Occasional Contributor
12 years ago

TestSuite parameters in command line when running with maven

Here's the status of the project:
There's a project with multiple test suites. In each test suite there are test suite parameters.
The project should be integrated with maven.
Here's what I'd like to do:
Run a test suite with a specific parameter value given from command line using maven(the pom.xml file was already done and has no properties defined).
At the moment, the testsuite can be run without the parameter value that I'm interested in being changed.
The closest I could get to is something like:
maven test -Dsoapui.properties.property.myProperty="propertyvalue"
I have no idea if I am even close to find the correct way to set the property value.
The property is used like ${#TestSuite#propertyname} in the testcases requests and asserts.

Any ideas?

5 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    hi, the link provides by nmrao definitively helps but it is for the command line tool, not directly for maven (you will have to figure out how to configure maven to do the same)
    You can also found information here: https://github.com/redfish4ktc/maven-so ... properties
    same as the previous link but translated for the maven world + also another way to set test suites properties with another implementation of the maven plugin (mine )
  • ipstefan's avatar
    ipstefan
    Occasional Contributor
    nmrao wrote:
    See if the following link helps
    http://www.soapui.org/Scripting-Propert ... rties.html


    As redfish said.
    I want to use maven command line to overwrite parameters/properties of the soapui testsuite.
    Would be better if it could be done with the standard maven plugin:
    <groupId>com.smartbear.soapui</groupId>
    <artifactId>soapui-maven-plugin</artifactId>
  • ipstefan's avatar
    ipstefan
    Occasional Contributor
    I have found a way to use TestSuite parameters from maven pom.xml file to soapui.
    I declared a test suite parameter/property.
    In the pom file I use in the configuration part:
    <configuration>
    <projectFile>${myProject}</projectFile>
    <projectProperties>
    <value>${TestSuiteProperty}</value>
    </projectProperties>
    .......
    </configuration>

    At the end of the pom file, just before the closing of the project tag:
        <properties>
    <TestSuiteProperty>myProperty="propertyValue"</TestSuiteProperty>
    <myProject>NameOfTheProject</myProject>
    </properties>
    </project>


    I can change the property value in the maven command line:
    mvn test -DTestSuiteProperty=myProperty="a new property Value"
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    ipstefan Thanks for providing feedback about your solution

    I've recently found that you should be able to pass projectProperties configuration with a command line argument. This is available for all parameters
    for the projectProperties parameter, you should be able to do it by setting
    -Dsoapui.projectProperties=<properties>


    for the parameter value, it is expected to be a String array.
    Based on stackoverflow (http://stackoverflow.com/questions/1335 ... ven-plugin) and a sonatype post (http://blog.sonatype.com/2011/03/config ... 05Refl_two, see the "Configuration of collection/array via system property" paragraph), this should work with maven 3.0.3+