Quantum driver names and capabilities
Learn about Quantum-specific driver names and capabilities.
On this page:
Driver names
The driver name in Quantum specifies the driver type to be used. This is defined by the driver.name
variable. You can set this variable in the application.properties
file or in the XML test definition, as follows:
-
driver.name=perfectoDriver
perfectoDriver
allows you to load theAppiumDriver
classes defined by thedriverClass
property inenv.resources
dirs. This is good for testing hybrid and mobile apps. -
driver.name=perfectoRemoteDriver
perfectoRemoteDriver
must be used if you plan to test remote Web cradles with desktop browsers or browsers on mobile devices.
Capabilities
Perfecto extends the Selenium capabilities to select a device. Appium capabilities (install app, and so on) are also supported.
When you use Quantum, capabilities are defined within the TestNG XML and the application properties file, and not inside the test.
The application properties contain general capabilities for use in all tests. TestNG contains device- and test-specific capabilities.
The properties in the following table are available to set driver capabilities, listed here in order of priority.
Capability |
Description |
Priority |
---|---|---|
|
Driver name specific capability configuration |
Highest |
|
Driver name specific capability configuration |
|
|
Capability applied to all driver names |
|
|
Capability applied to all driver names |
Lowest |
The following sections provide usage examples. For additional information, see Setting driver capabilities in the QMetry Automation Framework documentation.
Usage examples
Set an individual capability for a specific driver
<driverName>.capabilities.<capabilityName>
Example | Explanation |
---|---|
perfecto.capabilities.deviceName = 1547697078988
|
The driver.name key will be perfectoDriver or perfectoRemoteDriver . |
appium.capabilities.automationName = Appium
|
The driver.name key will be appiumDriver or appiumRemoteDriver . |
Set all capabilities for a specific driver
<driverName>.additional.capabilities
Example
appium.additional.capabilities = {'user':'user1@perfectomobile.com','password':'password','automationName':'Appium','applicationName':'Calculator'}
Explanation
The driver.name
key will be appiumDriver
or appiumRemoteDriver
.
Enable device audio recording
When attempting to use the Start Audio Recording command within a Quantum framework script, you may encounter the following error message: HANDSET_ERROR: No audio stream for cradle
To use the audio capabilities of a device, they must first be enabled as part of the capabilities. For Quantum, this means we must add the audioPlayback
capability to the TestNG configuration file under the device capabilities at the Test level.
Example
<parameter name="driver.additional.capabilities" value="{'audioPlayback':true}" />
The code below would enable audio capabilities for an iPhone device for the test IOS Calc Test.
Sample code that enables audio capabilities for an iPhone device
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Appium Demo Suite" verbose="0" parallel="tests">
<listeners>
<listener class-name="com.quantum.listeners.QuantumReportiumListener"/>
</listeners>
<!-- To use actual AppiumDriver classes defined -->
<!-- by driverClass property in env.resources dirs -->
<!-- Set driver.name value to perfectoDriver -->
<parameter name="driver.name" value="perfectoDriver"/>
<test name="IOS Calc Test" enabled="true">
<parameter name="driver.capabilities.model" value="iPhone.*"></parameter>
<parameter name="driver.additional.capabilities" value="{'audioPlayback':true}" />
<parameter name="env.resources" value="src/main/resources/ios"/>
<groups>
<run>
<include name="@appium"/>
</run>
</groups>
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
</classes>
</test>
<test name="Android Calc Test" enabled="true">
<parameter name="driver.capabilities.model" value="Galaxy S.*"></parameter>
<parameter name="env.resources" value="src/main/resources/android"/>
<groups>
<run>
<include name="@appium"/>
</run>
</groups>
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
</classes>
</test>
</suite>