Recording iOS Tests (Legacy)

Applies to TestComplete 15.70, last modified on December 17, 2024
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

The easiest way to create iOS tests with TestComplete is to record them. To record the tests, you use the Mobile Screen window. This topic provides detailed information on test recording.

Before Recording

You need to prepare your application, device and TestComplete for test recording. Follow these steps:

  1. Configure TestComplete, your iOS device, provisioning profile and instrument your iOS application. See Preparing Applications, Devices, and Test Computers for iOS Testing (Legacy).

    When preparing the iOS application for testing, make sure you use the TestComplete Agent Library version that matches your TestComplete version. The Agent from earlier versions of the TestComplete package may be incompatible with the TestComplete version you are using. When you instrument an iOS application from TestComplete, it always uses the newest version of the library.

  2. Open the Mobile Screen window. TestComplete uses it to record your actions on the application.

    If you have multiple devices connected to TestComplete, select the needed device from the drop-down list at the top of the Mobile Screen window:

    Selecting iOS device for test recording

    You can configure TestComplete to open the Mobile Screen window automatically when recording starts. See tips below.

  3. Launch your iOS application on the device. TestComplete can work with your iOS application only if the application is running on the device. If the application is in the background (for instance, if you are looking at the Spring Board or any other unprepared application), TestComplete is unable to record tests against your iOS device.

    We would recommend that you add your iOS application to the Tested Application collection of your test project. In this case, you can easily launch it from TestComplete IDE or your tests. For instance, you can run it from the TestedApps editor, or from the Project Explorer panel.

    There are some more ways of launching the tested applications before recording:

    • You can launch the application from the Recording toolbar that TestComplete displays after you start recording a test. To use this functionality, you need to add the application to the Tested Applications collection of your TestComplete project.

    • You can also automate the application start on recording. That is, TestComplete will automatically launch the application when you start recording. See tips below.

    • Of course, you can launch your iOS application on the device manually. You can use this approach, for instance, if you have not added the application to your project for some reason.

Recording Tests

  1. To start 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.

    • Press Shift+F1 (the shortcut can be changed in the Global Shortcut Options).

    The Recording toolbar will appear on the screen.

  2. If you have not yet launched your iOS application on the device, do this now:

    • If you have not added your application to the Tested Applications list of your project, then launch the application on the device manually.

    • If you have added the application to the Tested Applications list, then you can launch the application from the Recording toolbar:

      Running iOS application from the Recording toolbar
  3. Perform test actions on your iOS application in the Mobile Screen window.

    Tip: To record text input, click the text field in the Mobile Screen window and then enter text using your computer’s keyboard. See below.
  4. To stop recording, do any of the following:

TestComplete will open the recorded test in an editor, so that you can review and change it, if needed.

Recording Text Input

Text input on a mobile device is typically made with a special onscreen keyboard. TestComplete can record text input made with the onscreen keyboard. To record text input, you can use both the host computer’s keyboard and the device’s keyboard that you see in the Mobile Screen window:

  • During test recording, select the appropriate text field in the Mobile Screen window.

  • Type the desired text using your computer’s keyboard.

    – or –

    Click the keys of the device keyboard that you see in the Mobile Screen window.

TestComplete records text input using the SetText action of the corresponding control. If a control does not have the SetText action, TestComplete records the input as a call to the Device Keys keyword test operation or to the Device.Keys scripting method.

Notes:

  • During recording, it is not recommended to touch the key that hides the keyboard (“Dismiss-Key”). See below.

  • If you enter text with the device keyboard in the Mobile Screen window, TestComplete will record the input as calls to the SetText or Device.Keys scripting methods or the Device Keys keyword-test operation, it will not record the touches on the keyboard keys.

  • Text input in iOS TextField controls is recorded as setting the wText property if you do not press the Return (Enter) button at the end of the input.

Recording Screen Rotation

To record screen rotation, tilt the device until the orientation changes. TestComplete will record this change using the SetOrientation method.

Tips

Known Issues and Limitations

  • TestComplete does not record pressing on-device buttons, 3D touch and multi-touch gestures for iOS.

  • TestComplete does not record a touch on the key that hides the keyboard (“Dismiss-Key”). It is not recommended to touch this key during recording. If you touch the key and record test commands on objects overlapped by the keyboard, the recorded test will fail to run correctly.

  • If your iOS application uses animation, TestComplete does not record delays that occur when you are waiting for the animation to complete.

  • TestComplete does not capture object information for Visualizer images.

See Also

Testing iOS Applications (Legacy)
Testing iOS Applications - Overview (Legacy)
Creating Tests for iOS Applications (Legacy)
Simulating User Actions on iOS Applications (Legacy)

Highlight search results