3 min read time

Part 2 - Run TruClient – Native Mobile scripts on multiple devices

by in DevOps Cloud (ADM)

multiple devices_459x229.jpgIn the previous post in this series, I covered the process of preparing your script for performance testing while focusing on running on a single device. In this post, I’ll explain how you can run the same script on multiple devices. In addition, I’ll cover the usage of the extended log to find problems in your script in case it fails. 

When you develop your script, you first select the device that you want to use to create the test. This device is saved as one of the script’s assets. When you move the script to the controller, you can execute the performance test immediately on the same device without any additional configuration. If you want to run the same script on more than one device, you will need to add more Vusers to the test. Each Vuser will run on its own device. In order to assign a different device to each Vuser, you need to specify values for some pre-defined parameters that are automatically added to the script by TruClient. These parameters have empty values by default on every TruClient – Native Mobile script you create, but they are ignored unless you specify values inside them.  The parameters are: MobileDeviceMobileAppMobileServerUrlMobileServerUsername, and MobileServerPassword.

To specify multiple devices, add the devices’ identifiers to the MobileDevice parameter. Each device has a unique identifier. Since this parameter is defined as a unique parameter (which is updated only once in the lifecycle of a performance test), each Vuser will take one of the device identifiers and run on the corresponding device. So for a test to run on three devices, configure three rows with device identifiers. The first Vuser will use the first device in the list, the second will use the second, and so on.

 But where do I get the device ID?

This is simple. When you select a device from the devices attached to the UFT Mobile, the ID is included in the device’s details:


The other parameters are mainly used by monitoring but can be used also in LoadRunner. Let us look at them one by one:

  • MobileApp – Each application has an internal identifier inside the UFT Mobile server. When you create a script, you select the application that the script tests. TruClient saves the application identifier internally. 

    Consider the following scenario: you uploaded an application to the UFT Mobile and tested this application using TruClient. TruClient saved the application identifier internally. Two weeks later you uploaded the next version of the application. From the UFT Mobile perspective, this is a new version of the same application, and it is assigned with a new application identifier. You might want the test to continue running against the old version for the regression test, but you might want it to run against the new version for acceptance testing. This flexibility can be achieved using the MobileApp parameter. If you want the test to run against the version it was recorded on, you don’t need to set a value for this parameter. If you want to run the test against the latest version, set the parameter’s value to the application’s identifier string. This string can be obtained from the application selection screen:
  •  MobileServerUrlMobileServerUsernameMobileServerPassword – You probably guessed that these parameters are used for running the script against different UFT Mobile servers in parallel. You may want to do so in order to test the performance of devices in different locations.

Finally, I want to discuss the extended log. The user can configure the log level in the extended log. In the regular TruClient protocol, the extended log gives you the ability to see the different network logs such as to request and response headers. In the TruClient – Native Mobile protocol, also lets you see the communications between TruClient and the UFT Mobile server. This gives you the ability to get more information about errors that happened during script execution. To switch this function on, go to the Runtime Settings in VuGen under the Log tab, and select Extended log:

WS send: [this is the message sent from TruClient to UFT Mobile] {"type":"request","uid":0,"data":{"data":{"command":"executeStep","content":{"job":{"id":"9b0b6421-8f82-4575-9146-3e5196bf976b"}, "device”:{"id":"08b094572133005a"}, [This is the device id that the vuser is using] "action":{"name":"SetText","parameters":{"value":"********"}},[These are the parameters sent by the user for the action] "testObject":{"accessibilityId":"","boundsInScreen":{"bottom":1109,"left":60,"right":1020,"top":991},"children":[],"className":"Input","eventTime":1866712,"eventType":16,"index":1,"isPassword":true,"packageName":"com.hp.advantage","parent":{"className":"android.widget.LinearLayout","parent":{"className":"android.widget.RelativeLayout","parent":{"className":"android.widget.FrameLayout","parent":{"className":"android.widget.RelativeLayout","parent":{"className":"View","parent":{"className":"android.widget.FrameLayout","parent":{"className":"View"}}}}}}},"resourceId":"com.hp.advantage:id/loginPasswordEditText","tag":"","text":"","windowId":25}}}}}[This is the test object that the action is performed on. If you are familiar with the application implementation it can help you if there are problems with object identification]

Similarly, you will be able to see the incoming messages from the UFT Mobile. You are also encouraged to post in the TruClient LinkedIn group if you encounter issues.  If you provide the contents of this log as well, it will help us understand and resolve your problem more quickly.

This post explained how to run a single test against multiple devices. In addition, I introduced the extended log. 


Project & Requirements Mgmt
Application Lifecycle Management
Application Performance Management
Performance Testing
Application Security Testing
Functional Testing
Release Management