Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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.

I hear you say but what if the removed code actually serves a good purpose? The answer is simple. You can't prove it! According to Guantanamo, all code is guilty until proven innocent. Innocence is proven by test coverage. 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 source code, you can run Clover over it again and see the wonders it has done. In the case of our example, it would look like the following:


  • No labels