Forum Discussion

pskitsme92's avatar
pskitsme92
Occasional Contributor
3 years ago

Adding groovy function to script file

Adding 2 function to script file under bin\script\

class myClass

{

def f1(val1, val2){ ....}

def f2(val1){ def status = true

                    return status

  }

}

saving the file under bin\script\myscript.groovy, then adding groovy test step.

"

def s1= "s1"

def s2 = "s2"

util = new Myclass()

util.f1(s1,s2)  >>... This works fine

...

while  in another script

def s1= "s1"

 

util = new Myclass()

def returnVal = util.f2(s1)  ... This call fails with error missing the signature 

 It is as, if the update to the script file is never loaded to Ready API, I have restarted ready api but that did NOT help.

 

 

 

 

  • The problem was, when I updated Ready API from 3.9.0 to 3.9.1 the project still pointed to the bin\script under 3.9.0, 

    So problem solved, thanks for the help ;o)

5 Replies

  • pskitsme92's avatar
    pskitsme92
    Occasional Contributor

    The problem was, when I updated Ready API from 3.9.0 to 3.9.1 the project still pointed to the bin\script under 3.9.0, 

    So problem solved, thanks for the help ;o)

  • nmrao's avatar
    nmrao
    Champion Level 3
    Restarting the tool helped? Then what is the question?
    • pskitsme92's avatar
      pskitsme92
      Occasional Contributor

      Sorry I meant, restart Ready API  did NOT help.

      • nmrao's avatar
        nmrao
        Champion Level 3
        Don't see a reason for not working for method and working for other method.
        Just see if this is a reason.
        It is defined class as "class myClass"
        However, it is used "def util = new MyClass()" which is incorrect usage.