Using Low-Level Procedure in TestComplete

0
100

Sometimes there is a need for having some steps in your script which are out of the control of testcomplete recording feature and your scripting ability. TestComplete provide a feature so-called low-level procedure, when the actions are not determined by the interaction of the script with controls applications, and simple actions. For example consider steps below

  1. hold down the left mouse button,
  2. move the mouse pointer up a few pixels,
  3. release the left mouse button, press it again,
  4. drag pointer a few pixels to the left,
  5. Release the mouse button.

Such actions are usually necessary in graphics applications (eg, MS Paint), where neobhodimoprotestirovat drawing different shapes.
In TestComplete for such action exists to LLPlayer. To gain access to low-level routines, you must first add the item to the project Low Level Procedures Collection.

To do this, right-click on the project name, select Add – New Item and in the dialog box,

LLPMenu

Select Low-Level Procedures Collection.

LLPProjectItemNow while writing the script, you can click Start Recording a Low-Level Procedure and TestComplete will record a low-level procedure.

LolevelRecording

Once recording is stopped, the project will be recorded by a low-level procedure, which can be found in the project topic LLCollection1 .  below is sample recorded steps.

LowLevelStatements

Double click on any line opens a dialog box for editing actions. For example, the recorded delay (Column Delay) are usually not necessary and can be set to zero.

editevent

The following example shows a sample run of the recorded low-level procedure of the test script.

You will also notice a new sub gets created in your scripting unit with a call to the low level procedure just created.

Note that TestComplete can use the recorded coordinates relative to the screen or relative to a particular window. In this case we used Screen Related coordinates, i.e. the displacement of the mouse is measured from the upper left corner of the screen.

To run the same procedure with respect to a particular window, the window is enough to pass as a parameter to the method Execute:

If you do not record test scripts using tools recording TestComplete, and write them manually, you can use the object LLPlayer to perform low-level procedures. Sometimes there are situations when the usual methods (Click, Drag, etc.) for some reason does not work in the application under test, then you must use the object LLPlayer.

The LLPlayer object simulates pressing and releasing of mouse buttons, rotations of mouse wheels and pressing and releasing of keyboard keys from your scripts.

Methods of Llplayer

KeyDown Simulates pressing of a key.
KeyUp Simulates releasing of a key.
MouseDown Simulates pressing of a mouse button.
MouseMove Simulates movement of the mouse cursor.
MouseUp Simulates releasing of a mouse button.
MouseWheel Simulates rotating of the mouse wheel.

An example to use Llplayer object (from smartbear help)

Let us know if you have any experience using Low-Level Procedure in your projects or if you facing any difficulties using it via comments below.

Subscribe now to receive such information directly into your inbox.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.