Forum Discussion

dale_waterworth's avatar
dale_waterworth
Occasional Contributor
12 years ago
Solved

Calling function as keyword test parameter

How do you call a script function as a keyword test paramter?



Let say i have a keyword test that call a script routine :



function theTest(ref, magicNumber) {

 ...

}







Now we a new "Run Script Routine" to our keyword test that takes the 2 parameters.



When the operation parameters are selected i want both parameters to call a function being generateRef() and generateMagicNumber() which the results of both get passed to theTest(re, magicNumber) function. How is this possible?



I am aware of useLastResult but it doesn't suffice.



This means that everytime we need the use of more than one function result a new script has to written. 



Do you or anybody have any suggestions? How a have other got around this?

  • Hi Dezza,


     


    You'll need to call the Run Code Snippet operation and specify there the following:




    Runner.CallMethod("Unit1.theTest", Runner.CallMethod("Unit1.generateRef"), Runner.CallMethod("Unit1.generateMagicNumber"))




    *Unit1 is the name of the unit with your script files.


     


    Not a very elegant way, but it should work, though.