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

String getMonitorsData(csvFilePath)

Supported in iOS Supported in Android

Description

Return the content of the monitor values as string in CSV format.

Parameters

  • CSV File Path (optional): The absolute path for the file. Path must include the file name with *.csv. If value is blank, it will store the file in the report folder.
Note: When running the command, counter monitoring is on hold.

Usage

Command retrieves all Counter values which were collected during the test run so far.

Scenario: We will create a test on the EriBank demo application. During the test run, we will monitor the memory values of the application. At the end of the test, we will collect all counter values using this command 

Parameters:

  • csvFilePath (optional): Will be blank.

Result: The generated CSV file.

In this case, there are two columns. Date value was take and the value measured.

Energy Monitor Data

With Energy monitoring, additional lines are added to the output. Examples:

iOS

When running the following test:


Energy monitor Safari when a page is loaded
client.launch("com.apple.mobilesafari", false, false);
client.startMonitor("com.apple.mobilesafari:battery");
client.launch("http://en.wikipedia.org/wiki/Electric_energy_consumption", false, false);
String monitoringDataAsCsv = client.getMonitorsData("");

you may get an output similar to the following. From this data, we can see that energy was consumed on networking.


Android

Running the following script:

Energy monitor Chrome when a page is loaded
client.startMonitor("com.android.chrome:battery");
client.launch("chrome:www.wikipedia.com", true, true);
client.sleep(10000);
String str0 = client.getMonitorsData("");


Retrieved the following energy data in a csv file:

com.android.chrome

Date
cpu_power_use
wifi_power_use
gpu_power_use
rest_power_use
total_power_use
screen_power_use
2018.03.22 05:14:37 IST
0
N/A
N/A
0
0
0.055939499621
2018.03.22 05:14:38 IST
0.0135
N/A
N/A
0
0.0135
0.091759716717
2018.03.22 05:14:39 IST
0.0168
N/A
N/A
0
0.0168
0.116759716717
2018.03.22 05:14:40 IST
0.0173
N/A
N/A
0
0.0173
0.141759716717
2018.03.22 05:14:41 IST
0.0184
N/A
N/A
0
0.0184
0.167759716717
2018.03.22 05:14:43 IST
0.0205
N/A
N/A
0
0.0205
0.204759716717
2018.03.22 05:14:44 IST
0.0571
N/A
N/A
0
0.0571
0.233759716717
2018.03.22 05:14:45 IST
0.0833
N/A
N/A
0
0.0833
0.257759716717
2018.03.22 05:14:46 IST
0.0851
N/A
N/A
0
0.0851
0.281759716717
2018.03.22 05:14:47 IST
0.0997
N/A
N/A
0
0.0997
0.321759716717
2018.03.22 05:14:49 IST
0.103
N/A
N/A
0
0.103
0.353759716717
2018.03.22 05:14:50 IST
0.119
N/A
N/A
0
0.119
0.389759716717
2018.03.22 05:14:51 IST
0.136
N/A
N/A
0
0.136
0.414759716717
2018.03.22 05:14:52 IST
0.142
N/A
N/A
0
0.142
0.438759716717
2018.03.22 05:14:53 IST
0.15
N/A
N/A
0
0.15
0.471759716717
2018.03.22 05:14:54 IST
0.153
N/A
N/A
0
0.153
0.497759716717

Each row is the accumulated energy drain to this point from the start of the run.




The link to the .csv files is also attached in the reports as below

Convert the monitoring data to a graph

After generating the results.csv, you can import it into this site. (you can import multiple .csv files in order to compare between them)

Select the time and date as X axis and the total battery value as Y axis.

A graph such as this will be created and you can visually see you app's battery consumption over time:

  • No labels