Skip to Main Content
Apache Maven Cookbook
book

Apache Maven Cookbook

by Raghuram Bharathan
April 2015
Intermediate to advanced content levelIntermediate to advanced
272 pages
4h 59m
English
Packt Publishing
Content preview from Apache Maven Cookbook

Using the Maven Surefire plugin to run unit tests

A best practice of software development is writing automated unit tests for the code that you develop. Let us now see how to run these tests.

The plugin that does this job is the Maven Surefire plugin.

How to do it...

To run unit tests using the Maven Surefire plugin, perform the following steps:

  1. Open the command prompt.
  2. Run the following command on one of our sample projects:
    mvn test
    
  3. Observe the various steps that get executed:
    [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ simple-project ---
    [INFO] Surefire report directory: C:\projects\apache-maven-cookbook\simple-project\target\surefire-reports
    -------------------------------------------------------
     T E S T S
    ------------------------------------------------------- ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Apache Maven 3

Mastering Apache Maven 3

Prabath Siriwardena
Learning Apache Maven

Learning Apache Maven

Kevin Bowersox

Publisher Resources

ISBN: 9781785286124Supplemental Content