Forum Discussion

prabhat's avatar
prabhat
New Contributor
12 years ago

Unable to manipulate customproperty value using Maven(pom.x)

Hi,

I am using SOAP UI 5.0.0 to create the test cases for testing.
I am trying to automate the testCase using Maven pom.xml.
In Our SOAP UI prject we are setting custom properties to generate the dynamic json payload for the test steps defined in the testCase.

We are using using Groovy code to read the custom property values and manipulating the vale and again setting the value for the next iteration(running cycle).
groovy code for manipulating custom property(givenName):

def givenName = testRunner.testCase.getPropertyValue("givenName");
def familyName = testRunner.testCase.getPropertyValue("familyName");

int counterValue = Integer.parseInt(givenName.replace("User0",""))

testRunner.testCase.setPropertyValue("givenName", "User0"+ String.valueOf(counterValue+1) );

so that we can generate every time new payload for testcase (passing the property values in test step using "getdata" feature). This functionality is working fine in SOAP UI 5.0.0 Browser.

But when i am creating the pom.xml file for this soap-ui project the custom property value is not manipulating for the next interation.
Pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>5.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven2-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>D:/Project/src/test/soapui/UserManagement-Updated-soapui-project.xml</projectFile>
<outputFolder>D:/Project/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<printReport>false</printReport>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>



Please suggest if i am missing something.
Plesase let me know if any more information required.

Thanks
Prabhat

3 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    hi, what do you mean by next iteration? you run the test one, do some stuff, then rerun the test?

    if this is what you are doing this is the normal behaviour.
    In the SoapUI guy, properties modification are kept while you quit the application (modification kept in memory). If you quit without saving, the next time you reopen your project, you will have the initial value in your property.
    When running maven, when the execution is completed, the jvm stopped as when you close the GUI.

    So if you want to keep track of the property value, you need to save the project. To do so, set the saveAfterRun parameter to true
  • prabhat's avatar
    prabhat
    New Contributor
    Thanks for the reply.

    Yes next iteration means rerun the test.

    Please give sample to how to set saveAfterRun parameter to true in which location means file(pom.xml or soapui-project.xml)

    Thanks