heldan
14 years agoNew Contributor
[Resolved] Synchronized properties in soapUI and loadUI?
Hi all,
How can I synchronized properties in soapUI and loadUI?
My current setup in soapUI and loadUI works fine when it is executed sequentially but as soon as I start parallel threads using loadUI I get problems since the thread uses each others property values.
Since this is fundamental in load testing I would be surprised if not supported but I can not find anything on this forum about it. In soapUIpro there is DataGen TestStep which might solve my issue but I only want to use the soapUI.
I would really appreciate if anyone have some hints since otherwise loadUI will not be an option for us which would be sad since it have many other nice features that I would like to use.
/Mikael
Bellow follows an example and my Groovy script that might explain my problem better.
------------ Example ----------------
I have a scenario where I will loop through a number of users, e.g. user1 -> user99, and perform a number of requests for each user.
To keep track of the user I have the following properties in soapUI.
Project Property: user_range_start = holds the start number in the range e.g. 1
Project Property: user_range_end = holds the end number in the range e.g. 99
Project Property: user_next = holds the value of the next user
TestCase Property: user = holds the value of the current user
The sequence will then be:
1. Get the next user and store it in Testcase property user
2. Step the Project Property user_next
3. Perform the login for the user.
4. Perform the additional requests.
5. Repeat step 1-4 above until reaching the end of the user range.
I am using a Groovy script for this, see below:
------------ Groovy script ----------------
// Create variables for reading/setting properties
def testcase = testRunner.testCase;
def project = testRunner.testCase.getTestSuite().getProject();
// Get properties for calculation of next user.
def user_prefix = project.getPropertyValue("user_prefix");
def user_range_start = project.getPropertyValue("user_range_start");
def user_range_end = project.getPropertyValue("user_range_end");
def user_next = project.getPropertyValue("user_next");
def user_suffix;
// Check if end of user range reached.
// Yes => start over from the beginning of the range
// No => get next user in range
if ( user_next.toInteger() > user_range_end.toInteger()) {
user_suffix = user_range_start;
project.setPropertyValue("user_next", (user_range_start.toInteger() + 1).toString());
}
else {
user_suffix = user_next;
project.setPropertyValue("user_next", (user_next.toInteger() + 1).toString());
}
// Set the property for the next user which will be used in next request
testcase.setPropertyValue("Username", user_prefix + user_suffix);
How can I synchronized properties in soapUI and loadUI?
My current setup in soapUI and loadUI works fine when it is executed sequentially but as soon as I start parallel threads using loadUI I get problems since the thread uses each others property values.
Since this is fundamental in load testing I would be surprised if not supported but I can not find anything on this forum about it. In soapUIpro there is DataGen TestStep which might solve my issue but I only want to use the soapUI.
I would really appreciate if anyone have some hints since otherwise loadUI will not be an option for us which would be sad since it have many other nice features that I would like to use.
/Mikael
Bellow follows an example and my Groovy script that might explain my problem better.
------------ Example ----------------
I have a scenario where I will loop through a number of users, e.g. user1 -> user99, and perform a number of requests for each user.
To keep track of the user I have the following properties in soapUI.
Project Property: user_range_start = holds the start number in the range e.g. 1
Project Property: user_range_end = holds the end number in the range e.g. 99
Project Property: user_next = holds the value of the next user
TestCase Property: user = holds the value of the current user
The sequence will then be:
1. Get the next user and store it in Testcase property user
2. Step the Project Property user_next
3. Perform the login for the user.
4. Perform the additional requests.
5. Repeat step 1-4 above until reaching the end of the user range.
I am using a Groovy script for this, see below:
------------ Groovy script ----------------
// Create variables for reading/setting properties
def testcase = testRunner.testCase;
def project = testRunner.testCase.getTestSuite().getProject();
// Get properties for calculation of next user.
def user_prefix = project.getPropertyValue("user_prefix");
def user_range_start = project.getPropertyValue("user_range_start");
def user_range_end = project.getPropertyValue("user_range_end");
def user_next = project.getPropertyValue("user_next");
def user_suffix;
// Check if end of user range reached.
// Yes => start over from the beginning of the range
// No => get next user in range
if ( user_next.toInteger() > user_range_end.toInteger()) {
user_suffix = user_range_start;
project.setPropertyValue("user_next", (user_range_start.toInteger() + 1).toString());
}
else {
user_suffix = user_next;
project.setPropertyValue("user_next", (user_next.toInteger() + 1).toString());
}
// Set the property for the next user which will be used in next request
testcase.setPropertyValue("Username", user_prefix + user_suffix);