Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Sep 26, 2017 12:04

Best practices and code samples to accurately measure application launch time

In the Application start command, a new capability of timeout ensure correct application launch measurement can be accomplished in a subsequent checkpoint.

You can set the application launch parameter 'timeout=0'. what this means is that the command will send a launch command to the application and return immediately, without validating that the application has opened. It is then possible to insert a checkpoint to measure the time it took for the application to open. Make sure to follow best practices to achieve accurate timer result for that checkpoint.


Backward compatibility: If the timeout is not defined, the command will validate that the application has started on iOS devices only.

UFT

appName = "myApp"
'start the application with timeout 0 (makes the function return immediately)
Device("DUT").Applications.Start "name=" & appName, "timeout=0"

'Wait for a text to oappear    
Device("DUT").Checkpoints.TextCheckpoint "Sign On", "source=camera", "timeout=30", "measurement=accurate"

'The open app time is below
openApp = Device("DUT").GetROProperty("last_timer_ux")/1000

 

Selenium
 IMobileWebDriver application = device.getNativeDriver("myApp");
//start the application with timeout 0 (makes the function return immediately)
application.manage().timeouts().pageLoadTimeout(0, TimeUnit.SECONDS);
application.open();
IMobileWebDriver visualDriver = device.getVisualDriver();
visualDriver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
//set accurate timers
visualDriver.manageMobile().visualOptions().genericOptions().setSourceOptions(MobileSourceOptions.CAMERA);
visualDriver.manageMobile().visualOptions().validationOptions().setAccurateTimer(true);

//Wait for the text to appear
visualDriver.findElement(By.linkText("Sign On"));
//Once the text appears, measure the time it took 
// The timerGet method is defined in https://community.perfectomobile.com/posts/964238-measuring-user-experience-ux-advanced
long uxTimer = timerGet(driver, "UX", "SignOnTimer"); 


Perfecto IDE
Application.Start(DUT, "myApp", Timeout= 0)
Text.Checkpoint(DUT, "Sign On", Timeout = 60, Threshold= 95, OCR-Source = Camera, OCR-Analysis = Automatic, Timer-Accuracy = Accurate)

Note: In the above checkpoints:

  1. Make sure the needle (text to search for) does not appear in the previous screen, otherwise the checkpoint will find it there and the user experience timer will be zero.
  2. It is recommended to use a high threshold so that you can be sure the desired text is indeed identified
  3. Depending on the type of measurement you want to conduct, you may want to do a checkpoint on the first element on the screen, or maybe the last. Many pages have static and dynamic elements to them: especially in native applications, developers tend to render the static elements first to give the end user the impression of a highly responsive application. What you may want to measure is rather the dynamic elements which will include the information the user is more interested in, and will depend usually on backend calls and delivery chain performance.