Aaron Chesny's Agile Java Blog

October 22, 2009

Integration Testing Woes

Filed under: Uncategorized — Honcho @ 2:38 pm

So today I had to figure out how to run integration tests with Maven2. (http://maven.apache.org/)

The Maven2 build approach to integration tests has some issues:

  • No convention for separate source directory for IT tests.
  • No default test runner for the integration-test phase.

Three solutions presented themselves for handling the IT (integration) tests.

  1. Use the failsafe plugin. (http://mojo.codehaus.org/failsafe-maven-plugin/) This uses naming conventions to build up a test suite. However, this approach can be broken since JUnit 4 allows test classes to use any name, thus providing unit tests and integration tests to get confused.
  2. Hack the maven script to force the test compilation and test running of a separate integration test source directory. This approach could take a long time to develop correctly, however, it’s a pay once and reuse type of solution. Could also be difficult to maintain unless you’re a Maven2 guru. (Ha, that rhymes)
  3. Separate the integration tests into a different project. This allows all the integration tests to be centrally located and run using the Maven conventional src/test/java directory. Tests can easy to copied over into a basic archetype with their own dependencies. Also this project can be independently executed on the CI. Should be simple to setup and follows the SRP. (Single Responsibility Principle)

The third option was the selected solution. If anyone else has faced this issue and has a different/better solution, please comment.

Advertisement

2 Comments »

  1. Cool :-)

    Comment by J — October 28, 2009 @ 11:47 am

  2. Hi, Amazing! Not clear for me, how offen you updating your achesny.wordpress.com.
    BernieR

    Comment by BernieR — November 8, 2009 @ 2:13 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.