maven and unit testing - combining maven surefire plugin AND testNG eclipse plugin

Posted by lisak on Stack Overflow See other posts from Stack Overflow or by lisak
Published on 2011-02-26T20:45:05Z Indexed on 2011/02/26 23:25 UTC
Read the original article Hit count: 272

Filed under:
|
|
|
|

Hey,

could you please share your way of unit testing in eclipse ? Are you using surefire plugin, m2eclipse & maven, or only testNG eclipse plugin ? Do you combine these alternatives ?

I'm using testNG + maven surefire-plugin and I had been using the testNG eclipse plugin a year ago so that I could see the results in testNG view. Then I started using Maven, but when I do "maven test phase" using m2eclipse, there is only console output and surefire reports that I can check in browser and to choose what test suite, test, or test method can be set up only via testng.xml.

On the other hand, if you use only surefire plugin and you have some specific settings regarding classpath etc., that you rely on, then running tests via testNG eclipse plugin doesn't have to be compatible with your code. Using surefire plugin, the classpath is different - target/test-classes and target/classes - than using testNG plugin, that is using the project classpath.

How do you go about what I was just talking about?

Is it possible to synchronize "maven test" using m2eclipse and surefire plugin WITH testNG eclipse plugin and view ?

EDITED: I'm also wondering, why the Maven project ("Java build path") output folder is target/classes for src/main and src/test whereas surefire plugin makes two locations target/test-classes and target/classes

Thank you very much for your your opinions.

© Stack Overflow or respective owner

Related posts about java

Related posts about unit-testing