mitchellt
11 years agoOccasional Contributor
SoapUI Load Test Properties
Hi,
I have a test suite containing multiple properties, example below:
Name: DynamicChangeId
Value: ${=context.changeIds.get((int)(Math.random()*context.changeIdsCount))}
changeIds is a list, changeIdsCount is the size of that list.
The in-line groovy script above will select a random value from the list.
The values are loaded into that list at the testsuite level in a "startup script", example below:
// Load Change Ids from file
try {
log.info("Loading Change Ids from file ...")
File file = new File('...\\Test_Data\\ChangeId.txt')
context.changeIds = file.readLines()
context.changeIdsCount = context.changeIds.size
log.info("ChangeIdsCount: " + context.changeIdsCount)
log.info("ChangeIds: " + context.changeIds)
log.info("Change Ids loaded Successfully!")
} catch (Exception e) {
testRunner.fail("Failed to load data file")
return
}
This all works fine at a testsuite level because I am able to access the properties via ${#TestSuite#DynamicChangeId} in a request.
My Problem:
When I create a load test (copying the startup script from testsuite) and try to access this property via ${#TestSuite#DynamicChangeId} I get the following error:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Double#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.Number]
at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2980)
at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2932)
at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2875)
at groovy.lang.MetaClassImpl.getMethodWithCachingInternal(MetaClassImpl.java:1203)
at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3079)
Is their anyway to setup dynamic properties in load tests in soap ui (like I've done above) ?
I have a test suite containing multiple properties, example below:
Name: DynamicChangeId
Value: ${=context.changeIds.get((int)(Math.random()*context.changeIdsCount))}
changeIds is a list, changeIdsCount is the size of that list.
The in-line groovy script above will select a random value from the list.
The values are loaded into that list at the testsuite level in a "startup script", example below:
// Load Change Ids from file
try {
log.info("Loading Change Ids from file ...")
File file = new File('...\\Test_Data\\ChangeId.txt')
context.changeIds = file.readLines()
context.changeIdsCount = context.changeIds.size
log.info("ChangeIdsCount: " + context.changeIdsCount)
log.info("ChangeIds: " + context.changeIds)
log.info("Change Ids loaded Successfully!")
} catch (Exception e) {
testRunner.fail("Failed to load data file")
return
}
This all works fine at a testsuite level because I am able to access the properties via ${#TestSuite#DynamicChangeId} in a request.
My Problem:
When I create a load test (copying the startup script from testsuite) and try to access this property via ${#TestSuite#DynamicChangeId} I get the following error:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Double#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.Number]
at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2980)
at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2932)
at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2875)
at groovy.lang.MetaClassImpl.getMethodWithCachingInternal(MetaClassImpl.java:1203)
at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3079)
Is their anyway to setup dynamic properties in load tests in soap ui (like I've done above) ?