jtheuer
16 years agoOccasional Contributor
response and property context in load tests
Hi, I use this script in a TestCase to transfer the response (the location header) to the next test steps. How do have to change the script so it works in a load-test, too? The context of the property must be bound to the thread, I guess.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
// get request property
def destination_request = testRunner.testCase.getTestStepByName("create");
int done_tests = testRunner.getResults().size();
assert done_tests > 0
def lastTestResult = testRunner.getResults().get(done_tests-1);
String[] paths = lastTestResult.responseHeaders["Location"].split("/");
assert paths.size() > 0
Long id = Long.parseLong(paths[paths.size()-1])
// assign single property
testRunner.testCase.setPropertyValue( "id", ""+id);