1
votes

In my test, Load Function Library is called in the reusable action associated with the test and when the action is completed same Function Library is loaded by the test using Load Function Library, This time UFT throws an error "Syntax error on loading Library from Resources " Can anyone suggest how to fix it as i cannot get this error using err.number also...

2

2 Answers

1
votes

Try changing you LoadFunctionLibaray statement to an ExecuteFile statement.

A library loaded using ExecuteFile will persist as local scope (local to the action).

Or, unless there is a need to NOT do so, you could associate the function library with the test and remove all the LoadFunctionLibrary calls. This is the way I've been doing it.

0
votes

You can't use OERN to catch compilation errors. The only fix is to not load/import the library twice.

To experiment with:

Option Explicit

Dim sX
' Dim sX ' 38078712.vbs(4, 5) ... !compilation! error: Name redefined

sX = "two to tango!"
On Error Resume Next
   sX = Mid(sX, sX, sX) ' 37990815\vbs\38078712.vbs(8, 4) ... !runtime! error: Type mismatch: '[string: "two to tango!"]'
   WScript.Echo Err.Description
On Error GoTo 0