Why is fail(); not default for all test methods?
You are not bound to the default. If you would prefer to have every new test fail, you can change that in your project specific properties. But before you do that, please read our reasons for the default setting.
JUnitDoclet is intended not only for XP in new projects, but for stabilizing existing applications as well. (The projects don't have to be XP either.) If you run JUnitDoclet for the first time on a project with serveral hundred classes, you would end up with thousands of fail(); statements. It would take you days, to get back to actual development. We believe, this is not a good way to get people to write more tests.
A new project does not have that problem. Why not use
fail(); as the default there?
Especially new projects are very dynamic. Classes appear and disappear, methods move between classes, they show up and vanish a short time later. In short: You do Refactoring, which is a very good thing. JUnitDoclet is supporting Refactoring. If a marker from the old file has no counterpart in the new file, it is moved to
testVault (a special test method each Test has). But there is one exception: If the marker is empty, it will be gone without any further notice! If all method markers would contain
fail(); you would end up with many warnings. They will get you bored and you slow down testing. We don't want that.
Programming has to be fun to deliver quality software. Tools have to serve the developer (not vice versa). Developers are smart and know what they are doing. If you do Test Driven Development you will write tests because you do TDD, not because of a tool that generates
In short: JUnitDoclet is standing at your side, not in your way.
fail(); as the default, you may get thousands of empty test methods. If they stay empty, this isn't better than no tests!
The fun of writing the actual test functionality remains your responsibility!
To find empty test methods, please use a script for now. (Damian O'Neill wrote one he likes to share.) Future versions of JUnitDoclet may offer other help here.