Ruby on Rails

OyenCov vs Simplecov

Simplecov shows which lines aren't covered. OyenCov can tell you which of those lines you should work on, from how your codes are used in production.

For almost all Ruby developers, Simplecov is synonymous with code coverage. Many other paid services like Coveralls, Codacy etc all repackage Simplecov reports, which are generated in your CI pipeline.

But, Simplecov is flawed and should not be the only tool you use in improving your test suites. Here are the whys.

100% coverage in a new project? Simplecov misses the codes not loaded in tests

A project with Simplecov score of 100%, event without any test suites.

demo-rails-sin-pruebas: Simplecov HTML report on the left, OyenCov report on the right.

A Rails project without any test suites can often be given a 100% test coverage score by Simplecov.

If your test codes don't trigger the autoloading of the codes, it won't be picked up by Simplecov. Here is the irony: Chances are the codes being shown in Simplecov are already autoloaded, and thus indirectly tested.So how do you know the codes that are totally not covered or touched by any test cases?

OyenCov combines the runtime data from both test and production to ensure all codes being used in all the environments are accounted for.

OyenCov correctly gives out a score of 0 for such project, and it tells you where are the low hanging fruits to start writing test cases and improving quality right away.

Don't be overwhelmed, OyenCov highlights where you can start first.

Controller actions sorted by their lack-of-coverage severity.

Some of the controllers we aren't testing enough.

Simplecov shows you a long list of files and their coverage %, but they can't show you if the file is being used or not, or maybe there are merely autoloaded in test times -- In which false +ve test coverage is also counted.

OyenCov comes to the rescue! We clearly show the classes/modules/methods that are being heavily used but lack test coverages, in clear red/pink/yellow/white rows.

More info on our usage-weighting formula can be found in OyenCov Docs: Score Formula page.

Keep Simplecov, then add OyenCov to your workflow.

Simplecov costs nothing and it has been great. For the Rails projects using OyenCov, it's also required for OyenCov gem to function.

However, we believe many teams can better benefit from a more actionable, useful test coverage metric that OyenCov offers.

Free preview for a limited period

Go OyenCov for your Rails app today!

Copyright of Estimado Pte Ltd. Being made in Malaysia.