PMD checks for JUnit tests are working again PDF Print E-mail
Wednesday, 11 October 2006

The custom PMD checks in the default configuration for the Java TDD Plug-in stopped working at some point, due to a PMD version upgrade. These checks were written to flag test classes that do not contain any test methods, test methods that do not contain any assertions, or assertions that only depend on compile-time values. These checks have been restored in the Java TDD Plug-in's default PMD configuration file.

The checks were written using XPATH expressions on the abstract syntax tree produced by PMD. As PMD has evolved, some of the node types and labels used in this internal tree have changed, so the older XPATH expressions no longer matched correctly. This wasn't reported as an error, however, since PMD just considers a match to be a rule violation, and a non-match to indicate conforming code.

I've rewritten the XPATH expressions to work with the current version of PMD used by Web-CAT, so the rules are now working again.