Native and hybrid app support

TruClient for Mobile supports both native and hybrid (combined Web and native) apps.

Native app support

TruClient detects objects in native mobile apps, generating a TestObject every time the user interacts with a native object, for all supported elements. TruClient sends the TestObject step to Mobile Center for execution.

For native apps, you use the JavaScript identification method with text fields. For more information, see Manipulate the test object properties.

Hybrid app support

Beginning with TruClient 12.55, TruClient - Native Mobile scripts use Object identification methods and WebView to recognize objects on your mobile device. A WebView is a native component that displays interactive web content. Hybrid apps host one or more WebViews together with other native components.

  • In Android, the WebView is based on Chromium.
  • In iOS, the WebView types are UIWebView (iOS 2.x and higher) and WKWebView (iOS 8.x and higher) .

You can use all of the TruClient Object identification methods on hybrid apps: Automatic, XPath, JavaScript, and Descriptors. You can modify the Object identification directly from within the Step section.

For the Descriptor identification method, you can specify an object by its ordinal.

For the JavaScript identification method, you have full access to the app's TestObject properties, allowing you to modify or delete them. This is especially useful in debugging failed steps. For details, see Working with JavaScript in TruClient.

Each time TruClient records a WebView component, it generates an Activate WebView step. This step always precedes the action on the WebView object. However, to run an individual step or to highlight a Web object—you must first run the Activate WebView step. If the Activate WebView step is not in the script, you can add it from the Toolbox.

Beginning with TruClient 12.55, for hybrid apps, JavaScript is evaluated in the application's Web pages, and not the in the TruClient browser. The JavaScript has direct access to TruClient's TestObject properties.

AUT interface library

Beginning with version 12.55, TruClient includes the AUT interface which allows you to access the AUT's document and window properties. For example:

AUT.window.location.href, (AUT.document.getElementsByTagName("INPUT"))[0];

By default, Web steps run in the WebView context and can utilize the AUT API.

Runtime, non-TestObject steps that use the AUT keyword, run in the WebView context on the device. If they do not use the AUT keyword, they run in the TruClient browser.

Back to top

JavaScript API

When creating scripts for mobile devices, you can use the JavaScript API as you do with non-mobile TruClient scripts. The following APIs are not supported when evaluating in the WebView context:

Utils

Utils.import, Utils.clearCookies, Utils.clearCache, Utils.addAutoHeader, Utils.removeAutoHeader, Utils.cleanupAutoHeaders, Utils.addAutoFilter, Utils.removeAutoFilter, Utils.cleanupAutoFilters

IO

IO.read, IO.write, IO.createDir, IO.delete, IO.isExist

TruClient and LoadRunner

TC.getUserIP, TC.setProxy, TC.addNetworkFilter, TC.clearNetworkFilter, TC.startLogRequests, TC.stopLogRequests

Evaluate C API is not supported for TruClient Native Mobile.

Mobile Center step arguments

TruClient integration with Mobile Center provides additional Web roles for Step objects.

Objects can have one or more roles, to which the relevant actions apply. For example, a button Web role, can have a Click, Tap, or Drag action. For details, see Step argument reference.

Synchronizing

Step types can be Web, Native, or Runtime (standard TruClient). For TruClient Native Mobile scripts, Web steps include actions that let you synchronize your test execution. These include closing dialog boxes that pop up, such as alerts or other prompts.

In addition, beginning with version 12.55, TruClient supports a variety of touch actions and gestures, such as Rotate, Rotate and Pinch, and Touch and Drag. All gestures can be recorded or added manually.

Step timeout

In the Step editor, the Step Timeout value applies as follows:

For both native and hybrid apps, the replay engine will wait 20 seconds for the object to appear. If the object is not found within 20 seconds, the step will fail.

Native apps have a limitation, that the value you specify in the Step Timeout field is ignored.

For hybrid apps, the value you specify applies to the actual action. For example, if you specify 60 in the Step Timeout field, the replay engine will wait one minute for the end event of the action.

Alternative steps

Most apps respond to standard DOM events, such as mouse-clicks rather than touch events. Many apps convert a touch into a mouse click. For this reason, TruClient's default behavior records clicks, and not taps. However, the tap actions are stored in the Alternative Steps list and will be available to you for use. For details about using Alternative steps, see the Step editor.

Known issues

  • Spy/Highlight operations do not generate Activate WebView steps. You can however, add them manually from the TruClient toolbox for native mobile.
  • Windows Phone devices do not support the enhanced TruClient 12.55 hybrid integration. Some of the capabilities such as object identification and addition step arguments, will not be available.
  • Web operations on apps that are not packaged, are not recorded.
  • When recording multiple apps, you may need to add a Launch Application step (via the Toolbox). This is useful in the case when a user would need to scroll or swipe to another view to see the app. This is not required for the app launched at startup.
  • It is best to record multi-touch gestures (such as Rotate and Pinch) on physical devices, and not from within the remote view.
  • If a recorded swipe gesture replays successfully but doesn’t affect the AUT, extend its duration manually or use a trigger swipe. To do a trigger swipe, do a long press until a cross appears. Then move in the direction of the intended swipe and release.
  • Some JavaScript functions require a partial evaluation in the TruClient browser, for the purpose of synchronizing the code in the app's web page and the TruClient browser. TruClient will indicate the synchronization with a "Synchronizing Data…" message in the remote viewer, or with a brief alert popup on iOS devices.
  • Transaction response time cannot be generated for non-packaged apps. For example, the native Android Settings app, you will not be able to measure the time it took to turn the Bluetooth feature on the device.

For additional issues and limitations, see the product Readme file.

Back to top

See also: