awl
4 years agoOccasional Contributor
Example needed: How to use a ValueProvider plugin to provide a property value?
Hello SoapUI experts,
can you please provide an example of how to access a custom @PluginValueProvider a.k.a. DynamicPropertyResolver.ValueProvider implementation class registered for a valueName (such as "randomNumber") from a property value?
Given the standard example for https://www.soapui.org/apidocs/soapui/DefaultPackage/PluginValueProvider.html
@PluginValueProvider(valueName = "randomNumber")
public class MyValueProvider implements DynamicPropertyResolver.ValueProvider {
@Override
public String getValue(PropertyExpansionContext propertyExpansionContext) {
return String.valueOf(1000 * Math.random());
}
}
How can I access the random value provided by the ValueProvider from a property defined in my TestCase?
I tried several variants:
${randomNumber}
${#randomNumber#}
${#Global#randomNumber#}
(...)
(and many others) as property values for a property named "testProp" - but without success...
So how can I make use of MyValueProvider and get hold of the random number returned by it from a TestCase?
Thanks a million in advance for your kind help,
awl