Delphi Code Coverage alive and kicking

Recently noticed DelphiCodeCoverage had a new home on GitHub, with several updates that make it stable. I had been it in a previous incarnation to assess DWScript test coverage, and help pick which aspects of the engine were in need of extra tests.

The DWScript tests can be quite heavy on exceptions, sub-processes and multithreading. The tests go after checking all things that should fail do fail as they should. That was a bit too much stress for the previous versions, which would occasionally crash. I am happy to say those issues are gone from the current version of DelphiCodeCoverage!

 

DCC can output its finding in several formats:

  • an EMMA export for compatibility Java toolchains
  • an XML export, compatible with a SonarQube plugin
  • an HTML report, for immediate consumption of the coverage results

The HTML report had not gotten much love for years, so I submitted a few changes to make the HTML report look slightly less ancient. There is a new mini-histogram and sortable columns. The unit coverage HTML DOM has also been simplified, so it opens faster in browsers on larger units.

Since the last time I quoted DWScript code coverage stats here (back in 2013!), things drifted a bit in the wrong direction percentage-wise. The codebase is now quite larger and more capable, but that is no excuse.

Overall DWScript unit test coverage is now 86% (down from 91%) while compiler coverage is 95% (down from 97%).

The current weak spots in testing are around the new refactored arrays (which added a lot of capability under the hood) and the COM connectors. The generics/specialization are still a work in progress, and it shows in the coverage report.

But with a working code coverage tool, hunting season is officially open again!