The code coverage functionality is useful when you are customizing Microsoft Dynamics NAV and want to test your work. It provides a quick overview of the objects for which code has been executed, and it displays the code that has been logged.
When you add the function (trigger) with ID 6 to Codeunit 1, the Code Coverage menu item appears on the Debugger submenu of the Tools menu. When users select the menu item, the trigger code must open a form. From here, they must be able to start and stop the logging of code. They must also be able to view the code that was logged.
The Code Coverage Overview Window
You access the code coverage functionality from the Debugger
submenu of the Tools menu and you can start and stop code logging.
You can also view the code that is logged. Further, you can use the
CODECOVERAGELOG function to start and stop the logging
of code. This function can also retrieve the current logging
The Code Coverage window displays the objects (tables, forms, reports, dataports, or codeunits) for which code has been executed and logged during one or more transactions. The Code Overview window displays code for the object that you selected in the Code Coverage window. Lines of code that were executed during the transactions are shown in black. Lines of code that were not executed are shown in red.
The Code Overview window displays code in a similar way to the debugger. However, while you see code being executed in the debugger, the Code Overview window shows you the end result, the code that has been executed. When a line of code is executable, a bullet symbol is shown to the left of the line. Only the information for lines that are marked with a bullet is correct. The lines of code that are not marked with a bullet are simply displayed in the color of the neighboring code lines.
You should not modify objects while using the Code Coverage tool because this will produce inconsistent results.