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 23 Next »

Download

http://builds.codehaus.org/public/project?project_name=Guantanamo

Get the jar from the "Build artifacts" tab.

Introduction

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. Guantanamo is part of the Extreme XP Tools family. Some thoughts about why it was created are written down here. 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, unreliable) code. It is defined like this:

And used like this:

Guantanamo Ant Task Documentation

Property

Description

Required

dest

Where to write the modified sources

Yes

clover

Path to <a href="http://www.cenqua.com/clover/">Clover</a> XML Coverage file (clover.xml)

*

jcoverage

Path to <a href="http://www.jcoverage.com/">JCoverage</a> XML Coverage file (coverage.xml)

*

(star) One and only one of these must be specified.

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 (smile)

Goals

  • Always leave guantanamoed code in a compiling state.
  • Work with other coverage engines than Clover (which is the only supported one for now).

Guantanamo has hijacked Ashcroft's JIRA, where you can post patches, bugs and feature requests.

FAQ

Q: Does the deleted code get deleted from the original sources?
A: No. The original sources are always left unchanged. Guantanamo writes the modified sources to a different folder that you have to specify.

Q: What about good code without tests? Will it be taken away and sent to Guantanamo too?
A: Yes. We follow our own rules here. Your code has to prove its innocence through coverage. We don't have to prove that the code has bugs, we just assume it has. And therefore it must be taken away. It is for your own security.

Q: If good code is removed, doesn't this question the validity of Guantanamo itself?
A: You can't prove that untested code is good. Things that cannot be proven good must go.

Q: Have you considered that enforcing too strict XP policies on developers may turn them against XP as a whole?
A: Mind your own business, or we'll send your operating system to Guantanamo as well. If you're not with us, you're against us you sloppy waterfall coder! If it isn't 100% covered it is evil, evil, evil!

  • No labels