Testing in the Maven way – Separating the Unit from the Integration Tests

9 Oct

Ferrite Dog

In preparation for this exercise, I relied on these references (here, here and here) for basic information and extended from there.  To be sure, this blog is based on Maven 3.0.3, TestNG 6.8, Java 7 and Mac OS X Lion.

As a preliminary, to make running unit and integration tests a cinch in Maven, you must bind the maven-surefire-plugin and maven-failsafe-plugin to the relevant goals in your pom.xml. Look at lines 10-12, 27-29 and 39-41. [note: just in case you are wondering what the heck are the differences between the failsafe and surefire plugins, look here.]

For me, the convention for annotating unit test methods is simply @Test.  Of course, for TestNG, you could use the annotation @Test(groups="unit"). But why would you want to do more without the corresponding return, especially when unit tests outnumber integration tests by a very wide margin?

Do pay heed…

View original post 196 more words


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 )

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: