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.
You need to prepare your application, device and TestComplete for test recording. Follow these steps:
Configure TestComplete, your iOS device, provisioning profile and instrument your iOS application. See Preparing Applications, Devices, and Test Computers for iOS Testing.
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.
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 combo box on the Mobile Screen’s toolbar:
You can configure TestComplete to invoke the Mobile Screen window automatically when recording starts. See tips below.
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. To launch your application from the Mobile Screen window, simply select the application name from the Run Apps drop-down list on the toolbar:
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.
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.
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:
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.|
To stop recording, do any of the following:
Press Stop on the Recording toolbar.
Press Shift+F2 (the shortcut can be changed in the Global Shortcuts Options).
TestComplete will open the recorded test in an editor, so that you can review and change it, if needed.
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.
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
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.
To record screen rotation, tilt the device until the orientation changes. TestComplete will record this change using the
You can configure TestComplete to display the Mobile Screen window automatically when recording starts. To do this:
Open the Options dialog (select Tools | Options from the main menu).
Expand the Engines | Mobile | General category.
Enable the Automatically display Mobile Screen when recording option.
You can automate the start of your tested iOS application on recording. To do this:
Add your iOS application to the Tested Applications list of your TestComplete project. See Adding iOS Applications to the List of Tested Applications.
You can record text input by using the Apple Wireless Keyboard connected to the device. If you do this, TestComplete will not capture Visualizer screenshots for the recorded actions.
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.