Interview Questions

Any ideas how to customize the default recovery system in order to close dialog boxes ...

SilkTest Questions and Anwsers


(Continued from previous question...)

103.Any ideas how to customize the default recovery system in order to close dialog boxes ...

Any ideas how to customize the default recovery system in order to close dialog boxes that are parented not to MainWin but to ChildWin would be greatly appreciated.
The default recovery system only checks those dialogs that are parented to the MainWindow specified in the wMainWindow constant.
the problem is that I want to use any recovery system that will allow me to close dialog boxes that are parented not to MainWin and I need some hints on this (using dll functions like GetForegroundWindow(), or something else).
Windows NT 4.0 with SP4, and SilkTest 5.0.


Answer1:
Well, this wouldn't be changing the default recovery any, but you could use an appstate that is basedon none rather than basedon DefaultBaseState.

Answer2:
Create a global variable
lwClose = {...}
Windows to close

and add a
TestcaseExist ()
window wClose

for each wClose in lwClose
if wClose.Exists ()
wClose.Close ()


Answer3:
Here's what you do,
In a given tree structure like this:
Win1 Win7
Win2 Win3 Win8 Win9
Win4 Win5 Win6
Notice that Win7 and Win1 have 2 different threads,
Whenever you declare a window: You just add it to the lwClose list.
Here's How: (assuming you just want to keep Win1 open
lwClose = {...}
Win9
Win8
Win7
Win6
Win3
Win5
Win4
Win2
That way you create your tree threads.
Or you can create a fancy Dismiss ()
which does the following:
for i = 1 to ListCount (lwClose)
do
for each wClose in lwClose
wClose.Close ()
except
do nothing (this is incase you cannot close a window before another

Answer4:
I haven't tried this, but, could you create your own ScriptExit or TestcaseExit function that overrides the ScriptExit or DefaultTestcaseExit?
Or could you use the lwLeaveOpen defined in your MainWin and put the dialog name there? Perhaps you could make the variable lwLeaveOpen *not* const and then in either ScriptExit or TestcaseExit put the dialogs you want to leave open. And/or use the GetNextCloseWindow method to close everything down to the dialog you want to leave open.
To get a better understanding of how the recovery system works, I suggest you read the defaults.inc file (but I don't recommend editing it; use ScriptExit or TestcaseExit to override it).

(Continued on next question...)

Other Interview Questions