Ask a Question

Adding groovy function to script file

SOLVED
pskitsme92
Occasional Contributor

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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
pskitsme92
Occasional Contributor

Re: Adding groovy function to script file

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)

View solution in original post

5 REPLIES 5
nmrao
Community Hero

Re: Adding groovy function to script file

Restarting the tool helped? Then what is the question?


Regards,
Rao.
pskitsme92
Occasional Contributor

Re: Adding groovy function to script file

Sorry I meant, restart Ready API  did NOT help.

nmrao
Community Hero

Re: Adding groovy function to script file

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.


Regards,
Rao.
pskitsme92
Occasional Contributor

Re: Adding groovy function to script file

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)

View solution in original post

nmrao
Community Hero

Re: Adding groovy function to script file

Thanks for sharing.


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: