Code Coverage via a Sakai tool

Introduction

A prototype Sakai tool was built to highlight the value of Automatic code reviews. The meaning of the generated reports and the tool itself and surrounding content are described.

The advantage of this approach are numerous:

  • reports may be generated live without restarting of a Server
  • The process of generation requires three mouse clicks
  • The tool and reports sit on the Internet
  • Report generation per webapp is normally less than 1 second
  • The reports themselves contain potentially valuable information.

The main disadvantage is that it will take me quite a lot of effort to make a polished product.

Index

Details

Code coverage allows you to see with X ray precision which parts of the code are is not being used during a given run. The technique is helpful for answering a number of questions associated with the primary question: Which parts of my code are not being exercised? For example:

  • Which extra Functional Tests are needed to exercise the majority of the code base?
  • Which code needs to be removed as Junk DNA?
  • Roughly which code is called when a given bug occurs?

The Open Source tool EMMA can enable code coverage functionality for SAKAI without modifying code. Emma achieves this via looking at the byte code of the Classes and adding its own intercepts. This slows the performance of the system by about 15% and causes an extra bloat of 10 MB to the Sakai-Demo. Thus code coverage is easily possible in a test environment.