Back to Course
TestNG & Maven

Adding Maven Surefire Plugin

What is the Surefire Plugin?

The Maven Surefire Plugin is responsible for actually running tests during the test phase of a Maven build and generating reports of the results.

Example Configuration

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.2.5</version>
  <configuration>
    <suiteXmlFiles>
      <suiteXmlFile>testng.xml</suiteXmlFile>
    </suiteXmlFiles>
  </configuration>
</plugin>

Why It's Needed

Without Surefire configured to point at testng.xml, running mvn test would not know to execute your TestNG suite.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course