Creating and Recording Low-Level Procedures

Applies to TestComplete 15.47, last modified on January 20, 2023
Information in this topic applies to desktop and web applications.

You can create low-level procedures in one of the following manners:

Before you create a low-level procedure, add the Low-Level Procedures Collection project item to your project. For more information on how to do this, see Adding and Removing Project Items and Their Child Elements. If you are going to record a low-level procedure, TestComplete will suggest adding the project item automatically.

Creating with the New Project Dialog

This way of creation is quite easy - all you have to do is to follow the dialog instructions. However, low-level procedures created this way are empty. Therefore, later you will have to fill them with mouse and keyboard events the procedure will simulate. You can do this using the Low-Level Procedure editor. For more information, see Editing Low-Level Procedures.

Creating via the context menu of the Project Explorer

You can create a low-level procedure in the same manner as you create other project elements:

  • Right-click the Low-Level Procedures Collection project item in the Project Explorer panel and choose Add | New Item from the context menu.

  • In the subsequent Create Project Item dialog specify the name of the procedure and the name of the file that will store the procedure. Then, click OK.

TestComplete will create the procedure with the specified name and location and show it as a child node of the collection node in the Project Explorer panel. Note that the created low-level procedure is empty. Therefore, you will have to fill it with mouse and keyboard events the procedure will simulate. You can do this using the Low-Level Procedure editor. See Editing Low-Level Procedures.

Recording Low-Level Procedures

You can record a low-level procedure while recording a keyword test or a script. Low-level procedures can be recorded in screen- or in window-relative coordinates (see Window- and Screen-Relative Low-Level Procedures).

  • To record a low-level procedure based on screen coordinates:

    1. Click Test Type | Record Low-Level Procedure (screen coordinates) on the Recording toolbar:

    2. If your project does not contain a Low-Level Procedures Collection project item, TestComplete will ask you to create one.

    3. Then, TestComplete will ask you for a name to give to the new low-level procedure. You can use any string as a name of the low-level procedure.

    4. After you specified the name, TestComplete starts the recording.

    You can also start recording a screen-relative low-level procedure by using the Low-level record shortcut specified in the Global Shortcuts dialog. In order to use this shortcut, TestComplete must be in recording mode.

  • To record a low-level procedure based on window coordinates:

    1. Click Test Type | Record Low-Level Procedure (window coordinates) on the Recording toolbar:

    2. TestComplete will show the Pick Object dialog. In the dialog, select the window, for which you would like to record the new low-level procedure, and click OK.

    3. If your project does not contain a Low-Level Procedures Collection project item, TestComplete will ask you to create one. You will then be asked for a name to give to the new low-level procedure. You can use any string as a name of the low-level procedure.

    4. After you specified the name, TestComplete starts the recording.

Note: You can record low-level events to a new or to an existent low-level procedure. If you record a screen-relative procedure and then overwrite it with a window-relative procedure, the recorded script code will not be executed successfully as the screen-relative events will be lost.

To stop low-level recording, click Stop, or click Record Script or Record Keyword Test.

You can record several low-level procedures while recording a single script or a keyword test. Each low-level procedure goes in a .tcLLP file that can be used by other tests or projects, or on other computers. The call to each low-level procedure is inserted into the recorded script routine as a call to the Execute method of the LowLevelProcedure object, for instance:

JavaScript, JScript

LLCollection1.LLP1.Execute(); // Screen-relative procedure
// or
LLCollection1.LLP2.Execute(w1); // Window-relative procedure

Python

def Test():
  LLCollection1.LLP1.Execute() # Screen-relative execution
  # or
  LLCollection1.LLP1.Execute(w1) # Window-relative execution

VBScript

Call LLCollection1.LLP1.Execute ' Screen-relative procedure
' or
Call LLCollection1.LLP2.Execute(w1) ' Window-relative procedure

DelphiScript

LLCollection1.LLP1.Execute; // Screen-relative procedure
// or
LLCollection1.LLP2.Execute(w1); // Window-relative procedure

C++Script, C#Script

LLCollection1["LLP1"]["Execute"](); // Screen-relative procedure
// or
LLCollection1["LLP2"]["Execute"](w1); // Window-relative procedure

A call to each low-level procedure is inserted into the recorded keyword test as the Call Object Method operation that calls the Execute method of the LowLevelProcedure object.

See Also

Testing Applications in Low-Level Mode
Editing Low-Level Procedures
Running Low-Level Procedures
Window- and Screen-Relative Low-Level Procedures

Highlight search results