Forum Discussion
AlexKaras
14 years agoChampion Level 3
Hi Andrei,
You did everything right. The only thing is that events are not attached neither to some given script unit nor to any other test project entity (task, web service, storage, etc.) but are global for the whole test project. Event is triggered and the handler's code it executed every time the given event was triggered regardless of what was the reason for triggering the event.
I am not sure if it is possible to figure-out from the handler code what task triggered the event. When I had to distinguish between two different tasks, I used the fact that these tasks requested different resources and the code was like this (DelphiScript mockup):
====================
if (pos('details.jsp', Request.RequestHeader) > 0) then // the task that requests the company details page
begin
...
end
else if (pos('process', Request.RequestHeader) > 0) then // the task that requests the directory page
case Request.RequestID of // Checks the request ID
1, 2:
begin
// make response contents available to other test procedures via strResponse global variable
strResponse := Request.ResponseBody.Contents;
end;
else // case
...
end // case
...
====================
Hope this will help.
P.S. Also I would recomment an excellent (from my point of view) thread available here: http://www.automatedqa.com/newsgroups/d.cgi?cmd=article&group=automatedqa.public.testcomplete&item=18660&utag=
You did everything right. The only thing is that events are not attached neither to some given script unit nor to any other test project entity (task, web service, storage, etc.) but are global for the whole test project. Event is triggered and the handler's code it executed every time the given event was triggered regardless of what was the reason for triggering the event.
I am not sure if it is possible to figure-out from the handler code what task triggered the event. When I had to distinguish between two different tasks, I used the fact that these tasks requested different resources and the code was like this (DelphiScript mockup):
====================
if (pos('details.jsp', Request.RequestHeader) > 0) then // the task that requests the company details page
begin
...
end
else if (pos('process', Request.RequestHeader) > 0) then // the task that requests the directory page
case Request.RequestID of // Checks the request ID
1, 2:
begin
// make response contents available to other test procedures via strResponse global variable
strResponse := Request.ResponseBody.Contents;
end;
else // case
...
end // case
...
====================
Hope this will help.
P.S. Also I would recomment an excellent (from my point of view) thread available here: http://www.automatedqa.com/newsgroups/d.cgi?cmd=article&group=automatedqa.public.testcomplete&item=18660&utag=
Related Content
- 6 months agomacheshmeh
- 2 years agoianlop
- 11 months agoIso_Yura
- 4 years agomcbane