Tom Copeland's Recent Posts

RSS Feeds

« Fun with DenyHosts | Main | New rule list for each PMD release »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451d3c069e200e55070aa6f8834

Listed below are links to weblogs that reference Better JUnit Tests with PMD - free chapter!:

Comments

No TestNG support?

Sounds good to me; what are some good TestNG rules/guidelines/suggestions?

Not related to this entry specifically, but how does PMD compare with IntelliJ's static analyser? I wonder what you, and users of PMD, have to say..

(Havne't used PMD yet - Just interested in your own experience/feedbacks you've received)

Hi Aviad -
Well, frankly, at the moment, IntelliJ's static analyzer is much better :-) But PMD's analyzer is pretty good, the price is right, and you can run it from the command line or Ant or whatever, so it works well for a nightly build operation.
Yours,
Tom

TestNG is annotation based- a common issue with the version that support Java 1.4 is that the annotations are JavaDoc based. For a test, one must put: @testng.test. For configuration aspects, you have comments like: @testng.configuration beforeTestClass="true". These can easily be flubbed by fat fingers, which can cause confusing results when running TestNG.

A nice rule set would be to validate TestNG JavaDoc comments.

You can also turn it around; it's possible to run the PMD tool as a JUnit test among your other tests.

http://blog.christoffer.me/2011/02/running-pmd-another-great-static-code.html

The comments to this entry are closed.