Forum Discussion
heldan
15 years agoNew Contributor
My problem remains but I have find some hints on the forum which I thought I could summarize. Unfortunately my problem still remains.
By the forum I have understood:
1. I should use the Load Script to initiate the properties on the loadTestContext.
2.In the test case I create a Groovy Test Step that reads the properties from the LoadTestContext within a synchronized code block.
My problem, if this is the right way to go, is that I can not find how the syntax would like for it and that the loadTestContext is always null.
In the Load Script I have tried;
context.setProperty("UserPrefix", "user");
context.setProperty("UserRangeStart", "23");
context.setProperty("UserRangeEnd", "30");
context.setProperty("UserNext", "23");
And in the Groovy Test step:
if (context.loadTestContext != null) {
synchronized (context.LoadTestContext) {
// Get properties for calculation of next user.
def user_prefix = context.LoadTestContext.getPropertyValue("UserPrefix");
}
else {
// uses project properties since the context will not be available for single request.
}
Right now I execute the Test Case from the Test Suite tab of the Project but I have also tried it as a load test and then got the exception below:
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTestContext.getPropertyValue() is applicable for argument
By the forum I have understood:
1. I should use the Load Script to initiate the properties on the loadTestContext.
2.In the test case I create a Groovy Test Step that reads the properties from the LoadTestContext within a synchronized code block.
My problem, if this is the right way to go, is that I can not find how the syntax would like for it and that the loadTestContext is always null.
In the Load Script I have tried;
context.setProperty("UserPrefix", "user");
context.setProperty("UserRangeStart", "23");
context.setProperty("UserRangeEnd", "30");
context.setProperty("UserNext", "23");
And in the Groovy Test step:
if (context.loadTestContext != null) {
synchronized (context.LoadTestContext) {
// Get properties for calculation of next user.
def user_prefix = context.LoadTestContext.getPropertyValue("UserPrefix");
}
else {
// uses project properties since the context will not be available for single request.
}
Right now I execute the Test Case from the Test Suite tab of the Project but I have also tried it as a load test and then got the exception below:
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.loadtest.WsdlLoadTestContext.getPropertyValue() is applicable for argument