Thursday, May 29, 2008

Silktest - Classic 4Test and Visual 4Test

I think that many of the silktest automation engineers do not know, Silkest has two outline editors. Visual 4Test, enabled by default, is similar to Visual C++ and contains colors.

Classic 4Test is one of the two outline editors you can use with SilkTest. Classic 4Test is similar to C and does not contain colors.

Below I have given the samples for both type of modes. To change editor modes, click Edit Menu -> "Visual 4Test" to select or clear the check mark. You can also specify your editor mode on the General Options dialog.

Sample Classic 4Test - Silktest Code



public LIST OF WINDOW GetChildObjects(Window wContainer, DATACLASS dcObject)
{
// To get All child objects.
// Used recursive method.
LIST OF WINDOW lwndObjects, lwTemp1, lwTemp2;
LIST OF WINDOW lwndChildren =
{
};
WINDOW wParent, wChild, wTemp;

do
{
if (wContainer.Exists (10))
{
lwndChildren = wContainer.GetChildren (TRUE, FALSE);

for each wChild in lwndChildren
{
if wChild.IsOfClass(dcObject)
{
ListAppend (lwndObjects,wChild);
}
else
{
lwTemp1 = wChild.GetChildren(TRUE, FALSE);
if (ListCount(lwTemp1) > 1)
{
lwTemp2 = GetChildObjects(wChild,dcObject); //To get particular objects
if (ListCount(lwTemp2) > 0)
{
ListMerge (lwndObjects, lwTemp2);
}
}
}
}
}
else
{
Print ("Container {[STRING]wContainer} window is not available.");
}
}
except
{
ExceptLog ();
}

return lwndChildren;
}


Sample Visual 4Test - Silktest Code


[+] public LIST OF WINDOW GetChildObjects(Window wContainer, DATACLASS dcObject)
[ ] // To get All child objects.
[ ] // Used recursive method.
[ ] LIST OF WINDOW lwndObjects, lwTemp1, lwTemp2
[ ] LIST OF WINDOW lwndChildren = {...}
[ ] WINDOW wParent, wChild, wTemp
[ ]
[-] do
[-] if (wContainer.Exists (10))
[ ] lwndChildren = wContainer.GetChildren (TRUE, FALSE)
[ ]
[-] for each wChild in lwndChildren
[-] if wChild.IsOfClass(dcObject)
[ ] ListAppend (lwndObjects,wChild)
[-] else
[ ] lwTemp1 = wChild.GetChildren(TRUE, FALSE)
[-] if (ListCount(lwTemp1) > 1)
[ ] lwTemp2 = GetChildObjects(wChild,dcObject) //To get particular objects
[-] if (ListCount(lwTemp2) > 0)
[ ] ListMerge (lwndObjects, lwTemp2)
[-] else
[ ] Print ("Container {[STRING]wContainer} window is not available.")
[+] except
[ ] ExceptLog ()
[ ]
[ ] return lwndChildren

1 comment:

Anonymous said...

Hi,

first of all, i'm a SilkTest Newbee.
Cann you provide a sample how to invoke this function?

Yours

Mike