About Recording Automated Tests

Applies to TestComplete 12.60, last modified on September 17, 2018

The easiest way to create an automated test is to record it. This topic provides information on recording automated tests in TestComplete:

Starting, Pausing and Stopping Recording

To start test recording, do any of the following:

  • Click Record Keyword Test or Record Script on the Test Engine toolbar.

  • Select Test > Record > Record Keyword Test or Test > Record > Record Script from the TestComplete main menu.

  • Click Record New Test on the toolbar of the Keyword Test editor.

  • Click Record Test on the Start Page.

  • Press Shift+F1.

If no project is open, TestComplete will show the Record Test wizard that will guide you through creating and configuring a project for your test. Then TestComplete will start recording.

TestComplete will show the Recording toolbar where you control the recording process.

Recording toolbar

To pause recording, click Pause on the Recording toolbar or press Shift+F10.

To resume recording, click Record on the Recording toolbar or press Shift+F1.

To stop recording, click Stop on the Recording toolbar or press Shift+F2.

Tip: You can change the shortcuts in the Global Shortcuts dialog.

Appending Recordings to the Current Keyword Test

If you use keyword tests, you can append the recorded operations to existing tests instead of recording new tests.

To append them to the end of a test:

  • Open the test in the Keyword Test editor.

  • Click Append to Test on the editor’s toolbar.

    Appending recording to current test
  • If a message appears asking where to append the recorded operations, select To End.

To append the recorded operations after a specific operation:

  • Enable the Specify the position to append the operations to test option in Tools | Options | General | Show Again Flags | Keyword Testing.

  • Open the test in the Keyword Test editor.

  • Select the operation after which you want to add the recorded operations.

  • Click Append to Test on the editor’s toolbar.

  • In the message asking where to append the recorded operations, select To Current Position.

After Recording Has Started

When you start recording, TestComplete performs several actions automatically:

  • Switches to the Recording mode and displays the Recording toolbar.

  • Minimizes the TestComplete main window (this depends on the Minimize TestComplete option, which is enabled by default).

  • Saves the changes made to the current project (this depends on the Save before recording option, which is enabled by default).

  • Creates a new script routine or keyword test where the test actions will be saved.

  • Turns off the Caps Lock key. TestComplete also turns off the Caps Lock key when starting a test run. This ensures that TestComplete will correctly simulate keystrokes.

  • Starts the tested applications that have the Autorun application on recording option enabled.

  • Displays the Mobile Screen window. This window is used when testing mobile applications (this depends on the Automatically display Mobile Screen when recording option, which is disabled by default).

Things That Can Be Done During Test Recording

Besides recording actions in your tested application, you can do the following during test recording:

  • When recording tests for desktop and web applications, create quick property checkpoints:

    Creating Quick Checkpoints during test recording
  • Create various checkpoints using the Create Checkpoint wizard:

    Creating checkpoints via the wizard during test recording
  • Record multi-touch gestures on Android device. For instructions, see Recording Gestures (Multi-Touch Events).

  • Launch applications that you added to the Tested Applications collection.

    Launching tested applications during test recording

    You can also run applications in a usual way - by using a desktop shortcut, Start menu and so on. TestComplete can trace the application startup and record the appropriate commands (see below).

  • Launch a mobile browser emulator for mobile web testing.

    Launching mobile browser emulator during test recording
  • Switch between keyword test, script and low-level recording (see below).

  • Insert comments into the recorded tests using the Add Comments button on the Recording toolbar.

  • Call custom record-time actions:

    Custom record actions

Recording the Application Startup

TestComplete traces the start of applications during the recording. After the recording is over, TestComplete may add test actions that will automatically start these applications. Depending on the application’s type, this is done in different ways:

Recording Desktop Application Start

To manage tested applications, TestComplete projects use the Tested Applications collection. You can add applications to this collection when you are creating a TestComplete project, or do this any time later. TestComplete also can add applications to this collection automatically.

During the test recording, TestComplete detects the launches of Windows applications. By default, it checks whether the launched application is added to the Tested Applications list, and if it is not, TestComplete displays a message box asking your permission to add the application to the list. If you confirm the addition, TestComplete will include the application into the list and insert the Run TestedApp keyword test operation or the TestedApps.ProgramName.Run(1, True) script instruction into your test.

To change the default behavior, use the Add applications to the list of tested applications setting. To view or change it, select Tools | Options from the TestComplete main menu and then choose Engines | Recording in the subsequent dialog). By default, the setting is enabled and TestComplete adds applications to the Tested Application collection.

There is another setting, Show 'Add <ApplicationName> to the list of tested applications?' message, that controls whether TestComplete asks your approval before adding the application. You can find this setting in the Tools | Options | General | Show Again Flags dialog. If the “Show...” setting is disabled and the “Add...” setting is enabled, then all desktop applications that you start during the recording will be automatically added to the Tested Applications collection of your project.

Recording Web Application Start

TestComplete detects the launch of supported web browsers during the recording and automatically inserts the Run Browser keyword test operation or Browsers.Item().Run() script instruction into the recorded test.

TestComplete does not include Web applications into the Tested Applications list automatically.

Recording Mobile Application Start

Due to specifics of the Android and iOS operating systems, TestComplete cannot trace the start of mobile applications. So, TestComplete is unable to record the “application-start” test commands automatically.

If you want to automate the application start in your tests, you need to add your Android or iOS application to the Tested Applications collection of your project manually and then insert the appropriate commands in your tests.

Changing the Type of the Recorded Test

TestComplete can record tests as –

You start recording either a keyword test or a script, but you can switch to another test type at any time during recording. To do this, use the corresponding buttons on the Recording toolbar.

Selecting recorded test type

When you switch to another recording mode, TestComplete inserts a call to the new test into the previously recorded test so that these tests can be played back in sequence. For example, if you switch from keyword test recording to low-level recording, TestComplete will insert a call to the low-level procedure into the keyword test.

Default Names of Recorded Tests

TestComplete automatically names new keyword tests and scripting routines. The name of a newly recorded test or routine looks like TestN, where N is a number. TestComplete generates a name that does not coincide with the names of the existing keyword tests or other routines in the scripting unit.

You can change the default name any time later. To rename a keyword test, use the Project Explorer. To rename a script routine, change its name in the Code Editor.

Recording Different Types of Tests

Recording Options and Specifics

TestComplete has options that affect the recording process. To view or change them, you can do any of the following:

  • At design time, select Tools > Options from the TestComplete main menu and then select the Engines > Recording category.

  • During the test recording, click on the Recording toolbar.

For a full list of the options, see Recording Options Dialog.

For specifics of recording tests for different types of applications and UI elements, see Recording Specifics.

See Also

Recording Tests

Highlight search results