NetBeans Showstopper: Running Tests

July 01, 2009 | 3 Minute Read
This post was originally posted on my old blog.

Update 2009-07-02: Adam Bien has some related info here, but this still does not solve my issues (easily running single test methods, failing JUnit tests in maven projects, crappy TestNG integration in maven projects)

netbeans-logo.pngBasically I like NetBeans. I have been successfully prototyping applications in NetBeans, and especially the Glassfish integration is superb.

Unfortunately all the commercial projects I have been working on had been using Eclipse. Compared to Eclipse, I think NetBeans is much more intuitive to use and better organized.

Another advantage of NetBeans, is the native Maven integration, which seems still to be a major kludge in Eclipse.

Recently NetBeans 6.7 was released. This motivated me to toy around a bit.
But soon I encountered a major showstopper: the infrastructure to run tests is really poor!

It seems not to be possible to run single test methods!
For me this is just not acceptable. To do micro-iterations and test-driven development, I have to be able to run single tests.

NetBeans only offers to run all Tests of the whole Project or the tests in a given File. That is just not good enough!
Both Eclipse and IntelliJ can run Tests on any granularity level (method, class, package, project), and I am heavily using this feature.

According to this bug-report, it should be possible to run single test methods for Ruby development in NetBeans, but I did not verify this.

Also the TestNG plugin seems to provide this functionality for projects using TestNG.

When I tried to run tests in a Maven project the situation got even worse! Basically I was only able to run all tests of the whole project.

With JUnit, while running the tests for the whole project (or from maven on the commandline) succeded, running the Tests from a single file failed (the project was a simple example from OpenEJB).
Both Eclipse and IntelliJ had no problems running the single tests of exactly the same project...

Running TestNG tests in a Maven project (I tried Hibernate Envers) was possible, but the IDE always delegated to Maven to run the test goal, which resulted in all tests beeing executed... slooooow... it did not matter if I chose to run a single test method or the tests in a file.
Again, both Eclipse and IntelliJ had no problems running the single tests of exactly the same project ...

RoadClosed.jpg Unfortunately I have to come to the conclusion that NetBeans is unusable for me, and I think for any project, that sets a focus on developer testing ...

Maybe I am overlooking something, then please enlighten me ...

Googling showed that also others had the same issue: here, here and here ... follow me on twitter, I need some friends :-)