See links in the Ant snippet below.
Do you have problems maintaining high test coverage? Send the untested code to Guantanamo!
Guantanamo is a tool that deletes all code lines that are not covered by tests. Consider this sample coverage report by Clover:
Removing that untested code
Guantanamo has an Ant task that you can use to remove untested (in other words, unnecessary) code:
After you have run Guantanamo over your sources, you can run Clover over the guantanamoed sources again and see the wonders it has done. In the case of our example, it would look like the following:
Eating our own dog food
Guantanamo is eating its own dog food. When it came to a working state, I ran it over itself, just to discover that there were lots of lines of code that were never executed. They no longer exist. And Guantanamo is still working fine. In fact, it has 100% coverage
- Always leave guantanamoed code in a compiling state.
- Work with other coverage engines than Clover 1.1.1 (which is the only supported one for now).
Guantanamo has hijacked Ashcroft's JIRA, where you can post patches, bugs and feature requests.
Q: What if Guantanamo deletes code that is good, like untested code that actually serves a purpose?
A: You can't prove that it serves any purpose at all if it isn't excercised by running tests.