Friday, May 30, 2008

Java 1.6 on Mac... at last!

It is here. After 1.5 years. Java 1.6 on Mac. But... it is only for the Leopard and only for 64-bit Intel machines.
PPC, 32-bit Intel and Tiger folks are currently still out of the board.
There are two interesting facts regarding this Apple's release.
  1. It was not announced on Apple Developer Connection Java topics RSS. In fact that feed is useless. I'm still receiving here a bunches of 3 identical notifications about release notes for Java on Mac 10.5. The date when this document was published is 2007-10-31. Yeah, after 6 month Apple still reminds me (and the other subscribers of that feed) about such "news".
  2. Almost month passed since Java 1.6 on Mac release. And there is complete silence about this event on the Desktop community on java.net. This is rather strange - there was a lot of complains about long absence of this release (e.g. here and here).
Anyway, it's good it is here.

Wednesday, May 7, 2008

Running TestNG on NetBeans 6.0

TestNG is a great testing framework. And it's much more powerful than JUnit.
The problem for NetBeans 6.0 users is that there is no plugin for TestNG. I've spend a lot of time before I managed to run TestNG in a simple way. After some time I've figured out that the main obstacle is that NetBeans does not recognizes TestNG classes as test classes. And this was the key to success.
I've successfully run the tests using its command line and NetBeans Run feature. And it was done on the NetBeans Java SE bundle (the simplest one).
So, here are the simple steps to launch TaestNG on NetBeans:
  1. Project Properties -> Libraries. Compile-time libraries must contain testng-XXX.jar (where XXX is your TestNG version). Also Run-time libraries must contain the path to your compiled tests (if you put your test to default test directory, than the path to compiled tests should be build/test/classes).
  2. Create TestNG xml file(s). There are instructions how to build such file in the framework site. E.g. create testng.xml and put it in the project root.
  3. Project Properties -> Run. Create new configuration. You may name is testNG ;) Enter org.testng.TestNG as the Main Class. Put your TestNG xml file(s) as Arguments. Multiple xml files should be separated by space. Enter your project directory as Working Directory.
Congratulations! Now you can run your TestNG tests through NetBeans Run feature.

P.S. Even if there will be only one person on Earth who saves a few hours this post worth its writing.