Sunday 9 April 2017

add testng file in pom.xml

  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jre.level>1.7</jre.level>
        <jdk.level>1.7</jdk.level>
        <suiteXmlFile>TestNG.xml</suiteXmlFile>
    </properties>

    <build>
        <!-- Source directory configuration -->
        <plugins>
            <!-- Compiler plugin configures the java version to be usedfor compiling
                        the code -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdk.level}</source>
                    <target>${jdk.level}</target>
                </configuration>
            </plugin>

            <!-- Following plugin executes the testng tests ;
           This plug-in is used during the test phase of software build lifecycle to execute tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <!-- Suite testng xml file to consider for test execution -->
                    <suiteXmlFiles>
                        <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                   </suiteXmlFiles>
               </configuration>
            </plugin>
        </plugins>
    </build>