Skip to content

Quantum TestNG file

Tal Abraham edited this page Nov 14, 2016 · 1 revision

The testng.xml file is located in the src/test/resources/config folder. It specifies the suite of tests to execute, and and for each specifies execution information.

The general structure of the file should comply with the template file:

    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
 
    <suite name="PerfectoBDD" verbose="0" parallel="tests">
    	
    	<test name="BDD Android" enabled="false">
    		<parameter name="driver.capabilities.deviceName" value="1215FC70BAE54004"></parameter>
    		<classes>
    			<class name="com.perfectomobile.quantum.runners.MyBDDRunner"></class>
    		</classes>
    	</test>
	
    	<test name="Generic_IOS" enabled="false">
    		<parameter name="driver.capabilities.platformName" value="iOS"></parameter>
    		<classes>
    			<class name="com.perfectomobile.quantum.runners.DataDrivenRunner"></class>
    		</classes>
    	</test>
	
    	<test name="Generic_Android" enabled="true">
    		<parameter name="driver.capabilities.platformName" value="Android"></parameter>
    		<classes>
    			<class name="com.perfectomobile.quantum.runners.DataDrivenRunner"></class>
    		</classes>
    	</test>
	 
    	<listeners>
    		<listener class-name="com.perfectomobile.quantum.listeners.QuantumTestListener" />
    	</listeners>
	  
    </suite>

Required Fields

The suite field is required and defines the set of tests that are executed. You can change the following attributes:

  • name - the name of the test suite.
  • parallel - indicates if multiple tests should be executed in parallel.

A test field should appear for each test scenario that should be run. Supply the value for the name attribute. The test field must include a definition for a runner class.

  • When using BDD specify either the MyCucumberTestRunner.
  • When using Java tests specify the JavaTestsRunner

The listeners field must be included.

Test specific capabilities

In addition to the capabilities configured in the [application.properties file](The application.properties file), you can configure additional capabilities in the testng.xml file. This is especially relevant for defining device selection capabilities, for example the driver.capabilities.platformName or driver.capabilities.deviceName, to be used for a specific test. Use the parameter tag to specify the capability, as shown below:

    	<test name="Generic_IOS" enabled="false">
    		<parameter name="driver.capabilities.platformName" value="iOS"></parameter>
    		<classes>
    			<class name="com.perfectomobile.quantum.runners.DataDrivenRunner"></class>
    		</classes>
    	</test>

Clone this wiki locally