Tuesday, July 6, 2010

TOCOVER marker as tests TODO

Every time I find TODO comment in the code I remove it and report it to the JIRA. Project is not the proper place for TODOs. Except...

Every time somebody reports me a bug I create unit test exposing it, fix it and keep the bar green. Usually. However sometimes there's a time pressure. What then?

Then I make the quickfix, test it manually, commit it and create test stub prefixed with the TOCOVER string. For example:

class TOCOVER_ShouldAssignUserToDocument {

  void shouldAssignUserToDocument() {


Prefix makes Maven's Surefire plugin to ignore the test till I implement it (I use Should*.class pattern for test classes).

I'm addicted to my test coverage stats so whenever I can I find all files matching TOCOVER.*groovy (I write tests in Groovy) pattern and complete the missing test for regression purposes (and higher coverage stats).


  1. How above @Ignore annotation to ignore testcases?

  2. Actually I need my TODO tests to start with the given prefix in order to easy find them using the IDE (ctrl+shift+n in Idea or ctrl+shift+r in Eclipse).