开发者

Functions triggered by a QTP recovery scenario must reside in their own library?

I inserted a function in one of my function libraries (which are referenced in the test's resources settings). It looks like this:

Public Function NWRecoverOnRunStep (AObject,AMethodName,AArguments,AResult)
  Print "NWRecoverOnStep MethodName='" & AMethodName & "' Result=" & AResult
End Function

(Obviously, I am in an exploration stage ;)

I also created a recovery scenario that says "Call NWRecoverOnRunStep upon error 'object not found'", saved that as a recovery scenario file, and associates that file with my test.

When I now run the test, QTP says "Error in library file.", blabla, plus under details:

File: [QualityCenter\Resources] mylib.qfl

line (1): 'Dim CaptchaCheckActive '.

Description: Name redefined

(I am using option explicit in all libraries.) (And: Of course, "Dim CaptchaCheckActive" is the first global variable defined in the library, and the library mylib.qfl contains both this declaration and the recovery handler.)

Q: Is this because the library is linked to my test twice, once for being my "traditional" function library, and once again for containing my recovery scenario function?

Alternative Q: Is 开发者_C百科it true that recovery scenario handling functions MUST reside in their own function library, i.e. separate from my other user-defined functions?

I did not see that stated in the dox.


While i cannot find documentation about this, empirically it looks as if the answer is YES. the library containing the handler(s) must not be contained under the Resources, Libraries list. Otherwise, the library will be parsed twice into the same "namespace", or scope, and the first declaration/definition will yield a redefinition error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜