Skip to main content

Next Generation Java Testing

Posted by mortazavi on January 29, 2008 at 3:38 PM PST


If you're into Java testing, I think Cedric Beust and Hani Suleiman's Next Generation Java Testing: Test NG and Advanced Concepts might be a book you can profitably own as a very good reference on your shelves.

The material coverage and presentation demonstrates a good deal of intelligent thinking, and most topics are discussed thoroughly enough.

True, the focus is on TestNG but reading paragraphs such as the following should help us become more sensible and not lose sight of what we want to achieve in tests:

Testing indiscriminately is foolish: It's much wiser to decide what needs to be tested and what doesn't. As we've stated time and time again, the value of a test suite is not the chunk of work done at any given time—it's the fact that the tests grow and increase over time, thus slowly testing more and more functionality. It's far more important to write a couple of tests occasionally but consistently than to write fifty tests once and then not bother with any new ones for months.

The book includes a 3-page summary description of TestNG, chapters on design patterns, enterprise testing, Java EE testing, integration, extensions, and digressions. The digressions chapter has many insightful essays, including one on "The pitfalls of Test-Driven Development," where the authors correctly assert that TDD promotes microdesign over macrodesign and that it can be hard to apply in real situations.

The design patterns chapter forms the main core of the book and would be the primary focus of Java testing professionals.

The appendices include one on IDE integration, which, unfortunately, says little about NetBeans and focuses on Eclipse and IntelliJ only. This is definitely an area worth improving. Other appendices focus on migration from JUnit, TestNG XML scripting and Javadocs.

An important concept in TestNG is the notion of test "groups" which allows a clean separation between the static model of the tests (the code that has been written) and the runtime model (which tests and in what order they are run). A powerful organizing concept, memberships in groups are stated in TestNG annotations.


Cedric - I am enjoying the book and I would recommend it with no hesitation. You and Hani have done a very good job. I look forward to your other work in the future. It is good to hear that you also have an interest in seeing an NetBeans plug-in. I'm sure NetBeans community would also be extremely interested in it ... So, it might just be as easy as connecting to the right people!

Thanks for the nice review, Masood.

NetBeans is not covered in the book because, unfortunately, there is no NetBeans plug-in for TestNG. Someone recently offered to pick up the abandoned one, but I haven't heard from him in a while, so I'm afraid that no progress has been made in this area...

We certainly hope to see a NetBeans TestNG plug-in at some point!