Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Integration and Functional Testing with Maven 2.0

The Better Builds With Maven book discusses the recommended practice of putting integration tests in a separate module. If at all possible, follow this advice.

If for some reason you can't put the integration tests in a separate module, here are some ideas.

Integration Tests Only

If you have only integration tests in the same module as your webapp, you can configure Surefire to skip the test phase, then run in the integration-test phase. See this page.

Both Unit and Integration Tests in the Same Module

If you need to run both unit and integration tests in the same module, it's possible, just not very pretty.

There is only one testSourceDirectory per module, so all of your test classes must reside in one directory structure, usually src/test/java.

In the 'test' phase, configure Surefire to exclude the tests in (for example) **/systest/**.

Bind another execution of maven-surefire-plugin to the integration-test phase, and reverse the exclusion pattern.

You can see an example of this in the Shale Usecases example app pom.xml file.

The Future

Rumor has it that Maven 2.1 will support something like src/it/java in the integration-test phase, in addition to src/test/java in the test phase.

  • No labels