max80
13 years agoOccasional Contributor
updating properties in LoadTestContext
Hi everyone,
I am trying to synchronize a counter in soap ui when running loadtest. I have studied following links:
http://www.soapui.org/forum/viewtopic.php?f=2&t=6365
http://www.soapui.org/forum/viewtopic.php?t=7218
http://www.soapui.org/Load-Testing/loadtest-scripting.html
http://www.soapui.org/Scripting-Properties/tips-a-tricks.html
However I can't find a way to reference shared variable (from loadTestContext) in the body of the request (same value goes to each virtual user). I am sure something is wrong with my understanding of the contexts, but can't see it. I checked property expansion help and can't see a way to reference load test context.
Please help!
My latest attempt:
I am trying to synchronize a counter in soap ui when running loadtest. I have studied following links:
http://www.soapui.org/forum/viewtopic.php?f=2&t=6365
http://www.soapui.org/forum/viewtopic.php?t=7218
http://www.soapui.org/Load-Testing/loadtest-scripting.html
http://www.soapui.org/Scripting-Properties/tips-a-tricks.html
However I can't find a way to reference shared variable (from loadTestContext) in the body of the request (same value goes to each virtual user). I am sure something is wrong with my understanding of the contexts, but can't see it. I checked property expansion help and can't see a way to reference load test context.
Please help!
My latest attempt:
if( context.LoadTestContext ) {
synchronized( context.LoadTestContext ) {
if( !context.LoadTestContext['init'] ) {
context.LoadTestContext['init'] = true
context.LoadTestContext['counter'] = context.testCase.getPropertyValue("prop_counter")
}
def mycounter = context.LoadTestContext['counter'].toInteger()
mycounter++
mycounter.toString()
context.LoadTestContext['counter'] = mycounter
context.testCase.setPropertyValue("prop_counter", mycounter)
}
}