From: Tomasz Wegrzanowski Date: 2006-08-05T03:50:35+09:00 Subject: Re: Automatically finding gaps in unit test coverage ? On 8/4/06, Robert Klemme wrote: > Tomasz Wegrzanowski wrote: > > Hello, > > > > Is it possible to somehow automatically check which parts of code > > are not covered by unit tests ? > > I don't know of any mechanism built into RubyUnit or a code coverage > tool. But this is something you could do: use set_trace_func to trace > all methods invoked, then at the end of a single class's test case or > when all tests are done go through your classes and check their > #instance_methods to verify that all of them were called. But that > still does not give you info whether you had a proper test case for the > method or the method was called by some other method etc. Maybe you can > extend the tracing to record only methods called from a unit test. > Still you would not know whether the method was simply called or whether > return values were checked or whether they were checked properly. Well, one cannot have everything :-). rcov is pretty useful for finding missing tests. My only problem with it so far is its inability to test coverage of metaprogrammed code, but I guess that can't be helped. -- Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]