October 2006
Intermediate to advanced
888 pages
16h 55m
English
It is incredibly useful to know what parts of your code are not getting exercised. This helps you to know when you have areas that are lacking in unit tests. In some cases, the coverage tool itself can show you bugs. For example, suppose you have an if statement that “should be” executed about half the time. If you find that it is never executed, that is an easily pinpointed bug.
The rcov command-line utility (and its corresponding library) are the work of Mauricio Fernandez. Install it as a gem.
To run it in the simplest case, simply invoke it with your program as a parameter:
rcov myfile.rb
Your program will run, but at the same time, rcov will be gathering statistics. By default, it will create a directory called ...
Read now
Unlock full access