Sensor-instrument an app during installation using Quantum
Currently, the Quantum Starter Kit enables only WebView instrumentation. If you need to use sensor instrumentation, perform the steps in this article.
To sensor-instrument your app during the installation process using Quantum:
-
Create a new
DeviceUtils.java
file (preferably with a different name, for exampleMyDeviceUtils.java
).Tip: Consider having this new file extend theDeviceUtils.class
available inquantum-support
(downloaded automatically by maven and the actual holder of the information that is used during installation). By extending this class and not just creating a new file, you can then use your class for everything. -
In the new
MyDeviceUtils
file, create a newinstallApp
function to contain the sensor instrumentation. You can copy-paste the original function and then add the sensor instrumentation to it. Here is an example.Copypackage com.quantum.utils;
import com.quantum.utils.DeviceUtils;
import java.util.HashMap;
import java.util.Map;
public class customerDeviceUtils extends DeviceUtils {
public static void installAppSensor(String filePath, boolean shouldInstrument) {
Map<String, String> params = new HashMap<String, String>();
params.put("file", filePath);
if (shouldInstrument) {
params.put("instrument", "instrument");
params.put("sensorInstrument", "sensor");
}
getQAFDriver().executeScript("mobile:application:install", params);
} -
Create a new step to install the app that requires sensor instrumentation and that uses the new
MyDeviceUtils
. You can copy-paste the existing step and then just change the function name and parameters passed. Here is an example.Copy@Then("^I am installing Sensor instrumented app\"(.*?)\"$")
public void installAppSensor(String application, boolean shouldInstrument) {
customerDeviceUtils.installAppSensor(application, true);
}