Recording is the simplest way to create you first auto test. No programming skills are required as it is extremely simplistic to go about and execute. In this recipe, we will make a recording of the first executable test to be launched to make sure it is workable.
Before recording the first test, we need to perform some prerequisite steps:
If you are working in the Windows XP or Windows Vista operation systems, you can get by with a usual calculator that comes along as an embedded system component. For Windows 7 and later, the embedded calculator will not work to handle the examples at hand, because it is much harder to obtain the calculus results from its text output field.
In order to record a test we need to perform the following steps:
At this point, we would have a floating window widget Recording with the buttons Rec., Stop, and Pause.
function Test1() { var wndSciCalc; var btn2; wndSciCalc = Sys.Process("CalcPlus").Window("SciCalc", "Calculator Plus"); btn2 = wndSciCalc.Window("Button", "2"); btn2.ClickButton(); wndSciCalc.Window("Button", "+").ClickButton(); btn2.ClickButton(); wndSciCalc.Window("Button", "**").ClickButton(); wndSciCalc.Window("Button", "5").ClickButton(); wndSciCalc.Window("Button", "=").ClickButton(); }
Test1
function, and from the context menu select the Run Current Routine menu item:All the actions made during the script recording are transformed by TestComplete to the corresponding scripting commands, that is, mouse-clicks, text input, and selection of elements from a drop-down list; all these actions are covered by specific corresponding commands.
In our example:
btn2
) declared, while other buttons are handled through the window variable (wndSciCalc
). This happens because the button 2 is being used more than once, which was duly recognized by TestComplete and further on transmuted into the recursively applied code in view.Although TestComplete is generating a readable code at the point of recording, all the recorded scripts are the least readable and not easily maintainable. Sometimes, in case of changes in the tested application, the prerecorded scripts should be redone from the scratch rather than unraveled or modified to fit new conditions. Hence, the recording technicalities are not recommended to be applied to create scripts that should be workable recursively with intention to be applied for regression testing.
However, there are several cases when recording is useful, for example:
18.223.170.63