Technical Note/TEST AUTOMATION

If you want to select a different TestNG test suite .xml files to run test from you can do the following in the pom.xml file:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.13</version>
    <configuration>
        <forkMode>always</forkMode>
        <systemPropertyVariables>
            <reporter.debug>false</reporter.debug>                     
        </systemPropertyVariables>
        <suiteXmlFiles>
            <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>

You can however add a specific test suite file to a Maven property:

1
2
3
<properties>
     <suiteXmlFile>testng.xml</suiteXmlFile>
 </properties>

To run the tests from a particular TestNG test suite file you can run the following command from terminal:

1
mvn clean test -DsuiteXmlFile=custom.xml