Monitor vitals
Overview
NeoLoad provides a MonitoringHelper class to monitor the vitals of the mobile being tested.
Available vitals depend on the mobile device tested and may contain:
- information about the battery (charge status, voltage, temperature, etc.)
- information about physical disks (total storage, available storage, etc.)
- information about memory usage (total storage, available storage, etc.)
- information about the mobile (IMEI code, ICCID, operator, etc.)
- information about the processes
- information about the screen (size, orientation, refresh rate, pixel format, etc.)
- information about the system version
For more information about the vitals available for each mobile device, please refer to Jamo Solutions documentation.
Add dependent libraries
To monitor the vitals, you need to add to your project the following dependency:
neotys-rest-api-dataexchange-client-X.Y.Z.jar.
This dependency can be downloaded from the Neotys Labs page.
Declare the monitoring class
MonitoringHelperBuilder class enables to create the MonitoringHelper object.
MonitoringHelperBuilder uses the following parameters:
- the MonitoringSupplier objet (the function that defines the monitoring action to execute)
- the DataExchangeAPIClient object (the Data Exchange API client)
Here is an example of Java code to create a MonitoringHelper object in order to monitor the vpba16 mobile:
import com.neotys.rest.dataexchange.monitoring.MonitoringSupplier;import java.util.List;import java.util.ArrayList;import com.neotys.rest.dataexchange.monitoring.MonitoringHelper;import com.neotys.rest.dataexchange.monitoring.MonitoringHelperBuilder;final MonitoringSupplier monitoringSupplier = new MonitoringSupplier(){@Overridepublic List<String> get() {final List<String> xmlOutputs = new ArrayList<>();try {xmlOutputs.add(vpba16.batteryInfo());xmlOutputs.add(vpba16.driveInfo());xmlOutputs.add(vpba16.memoryInfo());xmlOutputs.add(vpba16.phoneInfo());xmlOutputs.add(vpba16.processInfo());xmlOutputs.add(vpba16.screenInfo());} catch (final MeuxException e) {}return xmlOutputs;}};final MonitoringHelper monitoringHelper = (new MonitoringHelperBuilder(monitoringSupplier, dataExchangeAPIClient)).build();
Use the monitoring class
With the MonitoringHelper class, you can start and end the monitoring of vitals on a mobile.
The start of the monitoring is done via:
- Method startMonitoring () to retrieve the vitals, with a delay of 30 seconds by default between the end of a monitoring execution and the start of the following one.
- Method startMonitoring (final long delay, final TimeUnit unit) to set the period between the end of a monitoring execution, the start of the following one and the period unit.
The end of the monitoring is done via:
- Method stopMonitoring () to end the monitoring with a delay of 60 seconds by default (data obtained beyond this 60-seconds delay will not be retrieved).
- Method stopMonitoring (final long timeout, final TimeUnit unit) to end the monitoring by setting the delay following the current monitoring action.
Example of Java code to start and end the monitoring of vitals on a mobile:
// Start vitals monitoringmonitoringHelper.startMonitoring();// Do some transactions// Stop vitals monitoringmonitoringHelper.stopMonitoring();
Home