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
// test
end;
CT_2_4 procedure;
begin
// test
end;
CT_2_5 procedure;
begin
// test
end;
_________________________________________________
In another script I did so:
uses test;
procedure steps1;
begin
try
CT_2_2;
CT_2_4;
CT_2_5;
except
UserForms.TestUser.ShowModal;
end;
end;
If an error occurs in CT_2_2 step CT_2_4, CT_2_5, I would like to open the UserForms, but that's not what happens.
Could someone help me? I thank the collaboration.
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?