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 Digital Lab 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
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 details, see Object identification.
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 Work with JavaScript in TruClient scripts.
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 Steps box. See Steps box.
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
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.
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 products
TC.getUserIP, TC.setProxy, TC.addNetworkFilter, TC.clearNetworkFilter, TC.startLogRequests, TC.stopLogRequests
Evaluate C API is not supported for TruClient Native Mobile.
Digital Lab step arguments
TruClient integration with Digital Lab 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, 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. To see a list of the actions and gestures, expand the Step section and open the Action drop down.
Step timeout
In the Step editor, the Step Timeout value applies as follows:
For both native and hybrid apps, the replay engine waits 20 seconds for the object to appear. If the object is not found within 20 seconds, the step fails.
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 waits 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 are available to you for use.
Known issues
- Spy/Highlight operations do not generate Activate WebView steps. You can however, add them manually from the TruClient Steps box for Native Mobile.
- Web operations on apps that are not packaged, are not recorded.
- When recording multiple apps, you may need to add a Launch Application step (from 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 indicates 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 cannot measure the time it took to turn the Bluetooth feature on the device.
See also: