R Services - Mango Solutions

testCoverage

Writing high quality unit tests is an essential behaviour for developing robust code. However, traditional unit testing frameworks, such as testthat and RUnit, only tell part of the story. The test expressions are submitted to a black box, and the results of the test are returned. This black box testing is essential for flagging broken code.

TestCoverage is an R package that adds an additional layer of transparency to unit testing. This clear box testing allows faulty code, untested code and unreachable code to be visually identified.

The package instruments R source code, then performs unit tests from your framework of choice. As source code components are evaluated by running the tests, the event is recorded. The statistics of the unit test suite are then tabulated, and an HTML page highlighting the source code as hit or missed is generated. The testing process is much easier when you can see at a glance what is not being tested.

An open development arm of testCoverage is now available on GitHub (https://github.com/MangoTheCat/testCoverage).