8. Refine the Recorded Test

Applies to TestComplete 14.0, last modified on January 23, 2019

You can run the recorded test as is, but we suggest that you adjust it to make it more stable.

When you record user actions, for example, mouse clicks, TestComplete records coordinates where the click is performed. For example, the image below shows the Click operation that simulates a click at a specific point of the Search text box of the tested application:

Getting Started with TestComplete (Web): The Click operation recorded with coordinates

When you run the recorded test, TestComplete will simulate a click at the exact same point where it was performed during the test recording. This can be useful when you are testing a black-box application – an application to the controls of which TestComplete does not have access, and it has to rely on coordinates to simulate user actions. It also can be useful for testing complex controls, for which clicking on various parts of the control brings various results.

However, in this tutorial, we are testing an Open Application: TestComplete can recognize all its controls and has access to their properties and methods. Therefore, we do not need to rely on coordinates to simulate user actions.

In addition, the application we are testing has a responsive design: it adjusts the size and position of its controls according to the browser window size. Coordinates that TestComplete records for one browser window size will become incorrect when you run your test for another browser window size.

Let’s modify the recorded test so that it simulates all click actions in the top left corner of the appropriate controls. This way, the test will simulate clicks correctly regardless of the browser window size and the application’s current control layout:

  1. In your test, find the operation that simulates a click in the Search text box and click the ellipsis button in the Value column:

    Getting Started with TestComplete (Web): Click in the Value column of the Click operation
  2. TestComplete will open the Operation Parameters dialog for this operation:

    Getting Started with TestComplete (Web): The Operation Parameters dialog
  3. In the dialog, replace the recorded ClientX and ClientY parameters with 1. For TestComplete, this corresponds to a click at the top left corner of the control:

    Getting Started with TestComplete (Web): Adjust the click coordinates

    Click OK to apply the changes and close the dialog.

    Note: As an alternative, you can set the click coordinates to -1, -1. For TestComplete, this will correspond to clicking the center of the control.
  4. The same way, modify the coordinates of the operation that simulates a click in the search result list and on the item color check box:

    Getting Started with TestComplete (Web): Adjust the coordinates of the operation that simulates a click in the search results list
  5. If in your test you have any other operations that simulate clicks at hard-coded coordinates, adjust the coordinates if you wish.

  6. From the TestComplete main menu, select File > Save All to save all the changes.

Prev     Next

See Also

About Tested Web Page
Keyword Tests
Operation Reference

Highlight search results