Forum Discussion

sboris's avatar
sboris
Occasional Contributor
4 years ago

An attempt to set a property value of Integer data type throws an error

I'm trying to set an integer value for a property (groovy script in a test case and on a setup tab of the test case):

def count = 0
testRunner.testCase.setPropertyValue( "loops", count );

and getting an error message:

groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestCasePro.setPropertyValue() is applicable for argument types: (String, Integer) values: [loops, 0] Possible solutions: setPropertyValue(java.lang.String, java.lang.String), getPropertyValue(java.lang.String) error at line: 2

It looks like an Integers and Float are not supported. Where I'm wrong? 
The code below runs successfully.

def password = org.apache.commons.lang.RandomStringUtils.randomAlphanumeric(10)
testRunner.testCase.setPropertyValue( "upsPassword", password );


 

  • It can hold only string value.

    So, cast it to string while storing into property and parse it to integer when you get the value back and use it.

     

    testRunner.testCase.setPropertyValue( "loops", count.toString())
  • nmrao's avatar
    nmrao
    Champion Level 3

    It can hold only string value.

    So, cast it to string while storing into property and parse it to integer when you get the value back and use it.

     

    testRunner.testCase.setPropertyValue( "loops", count.toString())