Controller.$_closure1 – what? Oh, you mean .index()!
November 20, 2008 – 10:19 pmSo it’s been bugging me for a while that the action names within a controller always showed up like this on my code coverage reports:

Well, no longer! Version 0.9 of the Grails Code Coverage plugin now does some post processing on the Cobertura reports that replace the Controller.$_closure1 ugliness with the matching action name:
It’s not the most efficient post processing in the world – I’m basically iterating through all the controller actions and then replacing all occurrences of those class names with the action names in the report HTML files. If you find the post processing to be too annoying, you can turn it off by passing the “-nopost” argument to the command, like this:
grails test-app-cobertura -nopost
Thanks to Burt Beckwith and others on the grails mailing list for proposing options on how to line up the closure class names with the variable names to which they are assigned in the controller.
It only works for the HTML reports right now…I’ll work on adding it to the XML version of the reports next.
To install the plugin, type the following command:
grails install-plugin code-coverage


One Response to “Controller.$_closure1 – what? Oh, you mean .index()!”
Awesome! That’s a great improvement!
By Lee Butts on Nov 21, 2008