A gesture can be executed as a test item of a TestComplete project, or it can be executed from the Project Explorer panel, from the Mobile Screen window, from the Gestures editor, from script or a keyword test. You can use any of these approaches that suites your needs best.
|Gestures can be recorded and simulated only on devices that support a touch-sensitive interface. Usually, these are hardware devices. Gestures cannot be recorded or played back on virtual machines and emulators, unless they support a touch-sensitive interface.|
To run a gesture from the Mobile Screen window:
Press Play Gesture on the Mobile Screen toolbar.
In the ensuing drop-down list, do one of the following:
-- or --
To run a gesture from the Gestures editor:
Open the Gestures editor.
Right-click the desired gesture in the list and choose Run Gesture from the context menu.
To run a gesture from the Project Explorer panel:
Expand the AndroidGesturesCollection item in the Project Explorer panel.
Right-click the gesture category node and select Run | Run <Gesture_Name> from the context menu.
To execute a gesture as a test item:
Switch to the Project Explorer panel. If it is hidden, choose View | Project Explorer to make the panel visible.
Select your project in the Project Explorer and then select View | Organize Tests from the main menu of TestComplete. This will open the Test Items page of the project editor.
Click New Test Item on the toolbar of the Test Items page.
A new top-level test item will be added.
Click the ellipsis button in the Test column of the newly added test item.
In the ensuing Select Test dialog, specify a test that sets a mobile device as the current device for the test session.
Click New Test Item once again to add another test item.
Click the ellipsis button in the Test column of the newly added test item and choose the desired gesture using the Select Test dialog.
Select File | Save from the TestComplete main menu to save the changes.
Now the gesture will be executed when you run the project or project suite.
You can invoke gesture execution from scripts. To run a gesture from script, call the
Execute method of the run-time object that corresponds to the desired gesture:
Where CollectionName and GestureName are unique names of the desired collection and gesture. You can view and change collection and gesture names in the Gestures editor.
Execute method does not return until the gesture is played back completely.
Remember that, you need to specify an Android device or a virtual machine that will be current during testing. In scripts, you do this by calling the
Mobile.SetCurrent(...) scripting method before any other test actions:
Call Mobile.SetCurrent("MyDeviceName", 0)
To run a gesture from keyword tests, use the Play Gesture operation. When you add it to your test, TestComplete displays a dialog in which you can choose the desired gesture.
Remember that, you need to specify an Android device or a virtual machine that will be current during testing. In keyword tests, you do this by calling the Select Device operation before any other test operations.