Forum Discussion

ALBERTO_SERRANO's avatar
ALBERTO_SERRANO
New Contributor
11 years ago

Call script (VBScript) with ByRef args from KeywordTest

Hi I'm trying to call a function (VBScript) from a KeyWordTest passing two arguments ByRef In the call I pass two local variables LibRef and TpmCount to DllFunction2. The execu...
  • HKosova's avatar
    11 years ago
    Hi Alberto,



    ByRef doesn't work with project, project suite and keyword test variables. You need to access the variable directly to change its value:



    Function DllFunction2(Lib, CntVariableName)

      ...

      If Result Then

        KeywordTests.Test1.Variables.VariableByName(CntVariableName) = Count

      End If

      ...

    End Function



    and call the function like this:

    Run Script Routine        DLLFunction2        Variables.LibRef, "TpmCount"




    You can use project variables instead of keyword test variables to avoid hard-coding the keyword test name inside the script function.