Forum Discussion

mfoster711's avatar
mfoster711
Regular Contributor
11 years ago

Keyword test Code Expression Mode in Edit Parameter

I am trying to use the Code Expression mode in the Edit Parameter window. I want to call a simple VB script routine I created to return a value an enter in the field. Here is my simple example of VBScript:



Function ThisIsATest()

    ThisIsATest = "Howdy"

End Function



In the Edit Parameter window I select Mode "Code Expression" and then enter "ThisIsATest" in the value but it does not call my function.
  • Hi Mark,

     


    To accomplish your task, you need to do the following:


    1. Add the Run Script Routine operation to the test, and specify your function there.


    2. To get the results of the function call, use the Last Operation Result value. Details...


     


    Thus, your test can look like this:


    Run Script Routine Unit2 - ThisIsATest Runs a script routine.


    Log Message LastResult, "", pmNormal, Empty, Empty, ... Posts an information message to the test log.