Delphi Code Coverage Wizard is a GUI which makes running the command line based code coverage tool easier.
If you have any DUnit or DUnitX unit tests for your project (which you should have to be able to automatically test your project and thus ensure its quality!) you also might want to know whether these tests cover all of your code or if there are any code paths which are not exectued by these tests.
Sometimes it is really hard to cover some specific paths, but in most cases it is not too hard to add further tests to cover code parts which are currently not yet covered by your unit tests. Doing so will increase your test coverage and thus lets you sleep better. This tool helps you to find out what's not covered yet. You can create a project you can run (it actually runs your unit tests) to create a report which shows you which lines were executed by your tests and which were not run.
You would add further unit tests then and re-run the coverage report project generated with this tool to update your test coverage report. You would run this until you either have covered all lines of your code by unit tests or have only those lines missing which would be really hard to cover.
The current version 2.1.1 is compatible with Delphi 12.0 Athens, 11.x Alexandria and most likely with 10.4.x Sydney.
In the root folder of the project you will find further files with information about this project like NOTICE.txt, CONTRIBUTING.md, SECURITY.md.
The command line tool used and included is the version of this one compiled at 2022/11/20: https://github.com/DelphiCodeCoverage/DelphiCodeCoverage
If the CodeCoverage.exe did not really change any parameters one can replace it with a new version, if desired. Later updates of this wizard should contain updated versions as well.
If you want to use the built in display of HTML formatted rerports you might need EdgeView2SDK from Tools/GetIt package manager to be installed first. Afterwards just open and run the project provided in the Source directory. When run for the first time or when you installed another version of the IDE it will display a dialog you can use to add it to the Tools menus of all Delphi versions/profiles it finds on your computer. It will additionally ask if it shall associate the .DCCP project file extension with the tool so you can open these files directly from file Explorer.
-
Make sure your project has detailed MAP-file generation turned on in linker settings.
-
Compile your project to get a MAP file created.
-
If not done yet, develop some DUnit/DUnitX unit tests for your project. If you set it up as a console project, you only need to press enter after the tests have run during code coverage analysis later, otherwise you need to start them manually (when using DUnit's GUI) each time when running code coverage.
-
Run this tool and generate a code coverage project for your project. The tool provides a wizard for this.
-
Save the generated project.
-
Run the generated project. It should start your unit tests.
-
Run your unit tests and close the test runner.
-
The coverage report should be generated in the format(s) you specified in the wizard. If you checked HTML format, the result will be displayed in code coverage wizard plus, but you can still open it in any browser outside this tool.
Now: enjoy!