Mock tests, Interview questions, Tutorials and Tech news
 
 
Home > Programming / tutorials > Maven Surefire for Integration Tests in JUnit

Maven Surefire for Integration Tests in JUnit

Maven surefire plugin is used to run unit tests during test phase of build lifecycle . The reports are generated in .txt or .xml file. These files are generated at ${basedir}/target/surefire-reports

Surefire runs unit tests during build phase, not integration tests which are executed during package phase. But you can include integration tests also to be run

Below is the configuration for surefire plugin in your pom.xml

<profile>
<id>itest</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.report.version}</version>
<configuration>
<includes>
<include>**/*IntTest.java</include>
<include>**/*IntTests.java</include>
</includes>
</configuration>
</plugin>

</plugins>
</build>
</profile>

Be Sociable, Share!
Categories: Programming / tutorials Tags: ,
  1. To Li
    June 18th, 2011 at 13:56 | #1

    What nonsense. The failsafe-plugin makes this better.

  1. No trackbacks yet.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes