Junit With Eclipse

Eclipse 2.0 has integrated support for JUnit. The org.eclipse.jdt.junit plugin supports launching JavaUnit tests from Eclipse and to view the test results.



EclipseIde supports parallel source folders, making it quite easy to separate tests from production code without messing around with packages. Only real problem I have with it is that it doesn't automatically add a new test case to the package's test suite, even though eclipse will regenerate the suite with the appropriate case added on request ('Recreate Test Suite'); really a minor issue though, I'm quite happy with the integration they've done. -- WilliamUnderwood


In the 2.1 development stream the JUnit plugin can find and run all tests inside a package, source folder or project.


It would be nice if the JUnit plugin could search for classes using a name filter (like in Ant). That way we could specify *Test to find tests. As it is now, if you subclass TestCase to make project specific additions (clean up or common meaningful asserts) you will get a warning that the subclass has no tests in it. This happens even if the subclass is in a different source folder than the tests.

A workaround would be to unwrap Eclipse's junit.jar to add entries to excluded.properties and wrap it again. But that seems like a lot of work to do every time you want to subclass TestCase. And it certainly is not project specific...


EditText of this page (last edited October 22, 2010) or FindPage with title or text search