Time for action – using Maven to run TestNG tests

  1. Create a new file named pom.xml under the project and add the following code to it:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test.maven</groupId> <artifactId>sample-maven-build</artifactId> <version>1</version> <name>sample-maven-build</name> <build> <!-- Source directory configuration --> <sourceDirectory>src</sourceDirectory> <plugins> <!-- Following plugin executes the testng tests --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.14.1</version> ...

Get TestNg Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.