From: patrick-may@... (Patrick May) Date: 2002-05-14T13:28:55+09:00 Subject: Re: code coverage tool? Thomas Sę·”ndergaard wrote in message news:... > I have a ruby module with about 1100 lines of code and another 1700 of unit tests. This gives me good confidence, but I would really like to know how much of the code is covered by tests. > > Is there a code coverage analysis tool for ruby? Something like OptimizeIt CodeCoverage for Java. I haven't heard of an automated coverage analysis tool However, I have a neat idea: Today I did a bit of coverage analysis by hand. I uncommented the lines of a method one at a time, running the tests between each bit. This let me discover exactly which lines were tested and which lines untested. While doing it, I couldn't help the feeling that this simple process could have been automated. This could be the basis for a simple coverage analysis tool. It could read in the source, comment out the code, and uncomment lines one at a time. You'd need a bit of regexp intelligence so that it would know to uncomment both ends things like if...end, etc. It could then produce a report of those lines that had no effect on the results of the test suite (filtering for white space). ~ Patrick