Last updated July 29, 2016.
One of the enhancement requests we frequently get is for load testing – specifically to enable HP’s LoadRunner to use Mobile Labs’ private mobile device cloud, deviceConnect™. It’s an easy request to answer because Mobile Labs’ Trust™ makes it possible to include real devices in LoadRunner scenarios. In this short note, we will show how it’s done.
HP’s LoadRunner is a load simulator that allows engineers to record web traffic or to write scripts that create server loads by creating virtual users. A Mobile Labs’ Trust script running on a deviceConnect device can be one of those virtual users, giving real device transaction times.
The above video shows a LoadRunner scenario graphing transaction times on an Apple iPhone 5S. Response time experienced by the app remains fairly consistent at around 5.5 -6 seconds, a great result. The transaction monitors the time it takes to log in, set up, and execute an inventory search.
Each time that LoadRunner gathers transaction data from the iPhone 5S, a Trust/UFT script uses Mobile Labs’ DevOps scripting language to obtain a device, launch the mobile app, and connect to the device, an example of hands-off test case automation. Once the app is up and ready to perform the test transaction, we initiate a measurement period, perform the script actions (login, search, logout), and then terminate the measurement period. The script then releases the device and closes the connection.
How hard was it to include this transaction in the LoadRunner scenario? When we created the scenario, we browsed to the Trust/UFT script, added it to the list of known scripts, and included it in the scenario all with the “New Scenario” dialog box.
The script is called “ForLoadRunner.” There are a couple of interesting features about the script. The first is the way we use deviceConnectCLI to launch the app, retain a device, and connect to the viewer:
The variable strConnectParam contains a deviceConnectCLI command that we construct from variables that were set from a data sheet:
10.1.10.54 email@example.com abcdef12 -d “5SiPhone” -scale 50 -r “PhoneLookup”
The command gives the address of deviceConnect, the name of the device, the app name, and the credentials of the user.
Second, we surround the section of the script that we want to measure with Trust/UFT transaction markers. LoadRunner uses these markers to learn the results of running the script. We were careful not to include time needed to connect, disconnect, or launch the app.
We knew the app was ready by performing an Exist() method on the root object :
Then we started our measurement:
The script then logs in to the app, sets up a search, and performs the search. Once the search is complete, we capture the end of the transaction:
That’s all there is to it. The video shows the transaction being measured repeatedly during the LoadRunner scenario and shows the correlation between the back-end load and the response time received on a real device. To run this scenario, you’ll need deviceConnect with automation, UFT, and LoadRunner with a license for GUI testing. For more information, you can check out an HP blog post here.
Want to learn more? Check out our latest posts!
Don’t forget to download our eBook on Amazon, to stay ahead of the curve in 2017!