Forum Discussion

maitreyoda's avatar
maitreyoda
New Contributor
14 years ago

Error message "No signature of method"

Hi all,

I'm using Groovy for the first time and I need your help.

I was using this line in my TestStep :
<SerialNumber xsi:type="xsd:string">${#TestCase#SerialNumber}</SerialNumber>

Now I would like to truncate the value before sending it to the server, using this line :
<SerialNumber xsi:type="xsd:string">${=${#TestCase#SerialNumber}.substring(2, 5)}</SerialNumber>

But I've this kind of error in Request Message of the Step :
<SerialNumber xsi:type="xsd:string">No signature of method: java.lang.Long.substring() is applicable for argument types: (java.lang.Integer, java.lang.Integer) values: [2, 5]
Possible solutions: toString(), toString(), toString(), toString(long, int)</SerialNumber>

What is bad in my request ? Is there another way to do that ?

Thanks,
maitreyoda

2 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    <SerialNumber xsi:type="xsd:string">${=Long.toString(${#TestCase#SerialNumber}).substring(2, 5)}</SerialNumber>
  • maitreyoda's avatar
    maitreyoda
    New Contributor
    Thanks M McDonald,

    It works perfectly.
    I understand now

    maitreyoda