Geertjan's Blog

  • August 18, 2010

Amazing Test Infrastructure for NetBeans RCP Apps

Geertjan Wielenga
Product Manager
Yesterday and today I worked through a lot of the FAQs, mailing lists, and other random documentation on the web in order to figure out a simple procedure for setting up unit tests, functional tests, and code coverage measurement for a NetBeans Platform application. Turns out, it was really easy, since all the related frameworks are part and parcel of the NetBeans Platform build harness. Simply go to the "harness" folder in your NetBeans IDE installation and you'll see what I'm talking about. Everything from extensions to Jemmy and JUnit for NetBeans Platform applications, to code coverage via Cobertura.

So I wrote this new tutorial, describing it all:


I sent it around to a few people to review it and I got this interesting e-mail back from NetBeans Platform guru Tom Wheeler:

"One thing that's noteworthy here (perhaps blogworthy) is that complete support for testing a platform application, including unit testing and functional testing -- plus reports showing you how effective that testing is -- comes "for free" when you build on the NetBeans Platform.

With a regular Swing application, you usually have to go set up your Ant build file to compile, package, run, test and measure test coverage for the application. This takes a long time to do when starting from scratch and is even still tedious to try and reuse build files from some previous project.

This has already been done for you when you build on the platform, which means that the NetBeans Platform is a good choice for even small applications, because you'll spend less time writing build files and more time writing code. The platform's modular architecture will make it easier to maintain your application as it grows."

I have a few tweaks to make to the tutorial, a few comments to process, but, really, it's all a pretty amazing thing. Forget about setting up unit test infrastructures, functional test infrastructures, and code coverage infrastructures, because the NetBeans Platform provides them out of the box. You simply need to use the existing infrastructure, rather than setting it up yourself. That's the point of the above tutorial.

Join the discussion

Comments ( 3 )
  • Klaus Wednesday, August 18, 2010

    Hi Geertjan

    Thanks for this hint. I wish I could spend more time working with and thinking about the Netbeans Platfom. Your contributions are truely motivating!

    One important "tweak" to your tutorial: When adding to the Test Libraries you have to include the INSANE module in both cases. Otherwise it will not work (at least in 6.9.1).

    Keep on blogging!

  • Geertjan Wielenga Thursday, August 19, 2010

    Added this to the tutorial, based on a comment from Jesse: "If you use 'Add Missing Test Dependencies' instead of 'Add Unit Test Dependency' and 'Add Functional Test Dependency', NB JUnit's recursive dependencies are properly configured. Otherwise INSANE will not be available, which can cause linkage errors when running tests."

  • Nicolai Husteli Thursday, August 19, 2010

    Hi Geertjan!

    Thanks a lot for your great tutorial. I hope you find time to create a similar tutorial for doing functional testing of a Netbeans application in a Maven environment.

    Nicolai Husteli

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.