Forum Discussion

p_bremm11's avatar
p_bremm11
Contributor
10 years ago

Calling Userforms after Error?

In another post, it was suggested that for dealings errors I could use UserForms, really liked the idea. So I use it, I did something like this: Sample procedure: CT_2_2 procedure; begin ...
  • AlexKaras's avatar
    AlexKaras
    10 years ago

    Hi,

     

    Not sure if I understood you right...

    Events and their handlers are global for the whole test project and event is handled immediately when it happens, without any further marshalling.

    So, you may have just

    uses test;

    procedure steps1;
    begin
    //     try
           CT_2_2;
           CT_2_4;
           CT_2_5;
    //     except

    //       UserForms.TestUser.ShowModal;

    //     end;
    end;

     

    and if the error happens, say, in CT_2_4 then the call stack will be:

    OnLogError

    CT_2_4

    steps1

     

    Depending on the scripting language used in your test you may or may not be able to get the name of the module/procedure where the error occurred (i.e. CT_2_4). In JScript this should be possible, in other languages supported in TestComplete - not possible.

     

    Note, that as TestComplete posts error messages about script runtime errors (e.g. if you try to divide by zero) to the log as well, this means that the OnLogError handler will be called for these errors as well.

     

    Does this help?