Recording Test Cases for Mobile Applications

This functionality is supported only if you are using the Open Agent.

When you record a test case with the Open Agent, Silk Test Classic creates locator keywords in an INC file to create scripts that use dynamic object recognition and window declarations. With this approach, you combine the advantages of INC files with the advantages of dynamic object recognition. For example, scripts can use window names in the same manner as traditional, Silk Test Classic tag-based scripts and leverage the power of XPath queries.
  1. Click Record Testcase on the basic workflow bar. If the workflow bar is not visible, click Workflows > Basic to enable it. The Select Test Type dialog box opens.
  2. Select 4Test Testcase.
  3. Click OK. The Record Testcase dialog box opens.
  4. Type the name of your test case into the Testcase name field. Test case names are not case sensitive; they can have any length and they can consist of any combination of alphabetic characters, numerals, and underscore characters.
  5. From the Application State list box, select DefaultBaseState to have the built-in recovery system restore the default base state before the test case begins executing.
    • If you choose DefaultBaseState as the application state, the test case is recorded in the script file as testcase testcase_name ().
    • If you choose another application state, the test case is recorded as testcase testcase_name () appstate appstate_name.
  6. Click Start Recording. Silk Test Classic performs the following actions:
    • Closes the Record Testcase dialog box.
    • Starts your application, if it was not already running. If you have not configured the application yet, the Select Application dialog box opens and you can select the application that you want to test.
    • Removes the editor window from the display.
    • Displays the Recording window.
    • Waits for you to take further action.
  7. On the device or the Emulator, interact with your native mobile application, driving it to the state that you want to test.
  8. In the Recording window, perform the actions that you want to record.
    1. Click on the object with which you want to interact. Silk Test Classic performs the default action for the object. If there is no default action, or if you have to insert text or specify parameters, the Choose Action dialog box opens.
    2. Optional: To chose an action for an object, which might not be the default action, right-click on the object. The Choose Action dialog box opens.
    3. Optional: If the action has parameters, type the parameters into the parameter fields. Silk Test Classic automatically validates the parameters.
    4. Click OK to close the Choose Action dialog box. Silk Test Classic adds the action to the recorded actions and replays it on the mobile device or emulator.
    For information about how to record an interaction with a mobile device, see Interacting with a Mobile Device.
  9. To verify an image or a property of a control during recording, click Ctrl+Alt.
  10. Optional: To interact with an object that is currently not visible in the Recording window, use the Hierarchy View:
    1. Click Toggle Hierarchy View. The Hierarchy View opens.
    2. In the object tree, right-click on the object on which you want to perform an action.
    3. Click Add New Action. The Choose Action dialog box opens.
    4. Proceed as with any other action.
    For example, to open the main menu of the device or emulator, right-click on the MobileDevice object in the object tree and select the action PressMenu().
  11. To pause the recording of interactions with the application, for example to move the application into a different state, click Pause.
  12. To resume recording interactions, click Start.
  13. To add the recorded interactions to a script, click Stop. If you have interacted with objects in your application that have not been identified in your include files, the Update Files dialog box opens.
  14. Perform one of the following steps:
    • Click Paste testcase and update window declaration(s) and then click OK. In most cases, you want to choose this option.
    • Choose Paste testcase only and then click OK. This option does not update the window declarations in the INC file when it pastes the script to the Editor. If you previously recorded the window declarations related to this test case, choose this option.