Last updated: Dec 19, 2017 12:02
In some cases it may be interesting to see how certain parts of an application perform over time. This can be done by adding timers to a test, which is scheduled to run every x minutes.
This simple Maven based tool will help gather the timers from each executed run in an Excel file, removing the need to do this manually.
This enables users to quickly pinpoint inconsistent test runs, and dive into video and report.
How to add a timer to a test in Perfecto Native Automation
Without modification, when executed the tool will connect to the specified cloud, parse the execution report for any Get Timer functions, and output the results including the timer name into the specified Excel.
For that it is necessary to wrap the action(s) you want to record with Timer start and Timer end functions, as well as Get Timer. These can be found under the Script section of the general Functions:
Adding Timer to a Native Test
Ensure to address the timer with the same name in all three functions, and chose UX timer if the UserExperience Timer is to be captured.
Timing a simple Text checkpoint for example may then look like this:
Adding Timer to a native Test
Tests can then be triggered manually, or programmatically through a CI Server, the Perfecto Scheduler or using the REST API.
How to use the Timer Extractor
The TimerToExcelExctractor project can be found at the following location:
The Extractor is a Maven Project containing a main function. When executing, it is required to define the Maven goals as well as commandline parameters.
The complete string should be
- Url. The Perfecto Lab url (e.g. mycloud.perfectomobile.com)
- Username (e.g. email@example.com)
- Password. the encrypted password (see paragraph on "Encrypting Password" for further information)
- TestPath. the path to the test (e.g. for above tests under MyScripts/timerTest the path would be PRIVATE:timerTest.xml)
- ExcelLocation. the desired location for the output Excel file (e.g. c:\timerResults.xlsx)
- TimeZone. the desired time zone of the time stamp added to the Excel for each execution (eg. GMT-4, see https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html for options)
- TypeOfExecution. LastSingleExecution or AllAvailableExecutions. LastSingleExecution will add only the very last execution to the Excel, as long as it has not been added.
AllAvailableExecutions will add all available Executions, the number depends on the configuration.
The example implementation uses below password encryption class:
The TimerToExcelExtractor project contains the PasswordEncryptTester class, which can easily be modified and run to obtain an encrypted version of a password.
Simply change the myPassword variable, as well as the mySalt and execute the main function.
How to execute from Eclipse
As an example for an IDE, here are the steps to execute the project directly from Eclipse.
- Add a new Run Configuration (Run -> Run Configuration -> Maven Build -> New Launch Configuration)
- Specify the Maven goals and arguments as under Parameters then Apply and Run e.g.: