Legacy | Add performance testing to your script

Configure a persona

To configure an automation script to work with a Persona, use the windTunnelPersona capability, or use the WindTunnelUtils static variable to select it, and use either a built-in Persona or a custom Persona as the value. The following snippet shows declaring the built-in Persona, Gerogia, as the script Persona:

Copy
  // Add a persona to your script (see https://community.perfectomobile.com/posts/1048047-available-personas)
  capabilities.setCapability(WindTunnelUtils.WIND_TUNNEL_PERSONA_CAPABILITY, WindTunnelUtils.GEORGIA);

This tells the Perfecto Lab to preconfigure your device according to the description of Georgia, the selected Persona, and activate any of the applications listed in the persona settings that are installed on the device of the script.

After incorporating a Persona into the automation script, defining our test environment (or chose to rely on one of the built-in persona), we can incorporate points of interest and timers to our test, to enable analyzing our test results in the Single Test Report.

Points of interest

It is easy to highlight areas of the test script that will be visible in the Single Test Report, by adding logical steps. Use the Smart Reporting SDK methods for identifying the logical steps and highlighting the results of verification steps in your script:

  • Add stepStart and stepEnd method calls to indicate the logical steps of the test.

  • Add reportiumAssert method calls to add status checks into the reports of the test execution.

Timers

Timer reports are the measured timer results as reported from the test into the generated Single Test Report. UX timers only work with text or image checkpoints. 

Note:

Specifically in native applications, it is important to distinguish between static content that is delivered with the application vs. dynamic content that is pulled from the service APIs. If you measure static content, you will likely get very short or even zero times because you really measure only the device processing and rendering time. On the other hand, what may be more interesting is to measure dynamically rendered content that is fetched from the service APIs, representing the round trip time, backend efficiency, the device/OS/application efficiency in receiving, decrypting, processing and rendering content.

To implement timers:

  1. Retrieve the user experience time (UX timer) of the previous command using the mobile:timer:info command, if applicable.
  2. Use the reportTimercommand to add a timer to the Single Test Report.

Use the specified checkpoint parameter values, as demonstrated in the example, to get the most accurate user experience time.

Copy

Java example 1

String resultString;
...
// Wind Tunnel: Adding accurate timers to text checkpoint command
params1.put("measurement", "accurate");
params1.put("source", "camera");
params1.put("analysis", "automatic");
params1.put("threshold", "90");
resultString = (String) driver.executeScript("mobile:checkpoint:text", params1);
...
// Wind Tunnel: Measure UX timer 1
long uxTimer1 = timerGet("ux");
...
// Wind Tunnel: Add timer to Single Test Report
WindTunnelUtils.reportTimer(driver, uxTimer1, 2000, "Checkpoint load time at welcome page.", "uxTimer1");
...
// Gets the user experience (UX) timer
    private static long timerGet(String timerType) {
         String command = "mobile:timer:info";
         Map params = new HashMap();
         params.put("type", timerType);
         long result = (long)driver.executeScript(command, params);
             return result;
    }
Copy

Click to view Java example 2

String resultString;
...
// Wind Tunnel: Adding accurate timers to text checkpoint command
params1.Add("measurement", "accurate");
params1.Add("source", "camera");
params1.Add("analysis", "automatic");
params1.Add("threshold", "90");
resultString = (String) driver.ExecuteScript("mobile:checkpoint:text", params1);
...
// Wind Tunnel: Measure UX timer 1
long uxTimer1 = timerGet("ux");
...
// Wind Tunnel: Add timer to Single Test Report
WindTunnelUtils.ReportTimer(driver, uxTimer1, 2000, "Checkpoint load time at welcome page.", "uxTimer1");
...
// Gets the user experience (UX) timer
    private static long timerGet(String timerType) {
         String command = "mobile:timer:info";
         Dictionary<string, object> params = new Dictionary<string, object>();
         params.Add("type", timerType);
         long result = (long)driver.ExecuteScript(command, params);
         return result;
    }

Single Test Report (STR)

The test report is automatically generated by the Perfecto Lab. To learn how to access the report and how to work with it see the section on Test analysis with Smart Reporting.

Samples

To see samples in Java, C#, and for UFT refer to the Perfecto Git Repository.

Note:

UFT sample may need to revert the end-of-line to CRLF for proper execution in UFT.