Running an application with code coverage produces a .tcz report file. Enterprise Developer uses the information in this file to provide statistics in the Code Coverage view about what percentage of the code has been executed as well as to colorize the code in the editor to indicate covered (executed) and missed (not executed) blocks as well as covered and unexecuted programs.
From the Code Coverage view, you can navigate to the covered and missed blocks of code in the editor, import code coverage data from existing .tcz files or merge the report files produced from different runs of the application, and relaunch the application in code coverage mode.
After executing an application with code coverage, the IDE automatically opens the Code Coverage view to display the code coverage information. (If the view is not visible, to display it, click ).
The view visualizes the code coverage information from the filename.tcz results file produced during the latest run with code coverage. The code coverage information can be displayed in two different views:
By default, the coverage per programs view is displayed. It displays the paragraphs and the sections within the program and what percentage of the code has been covered in the context of blocks:
To change to the file view, click (Coverage per Files). This view displays a list of files (both programs and copybooks) with their percentage of code which has been covered in the context of statements:
To view the covered and missed blocks, either scroll down the code of a COBOL program or double-click the lines of the program's structure in the Code Coverage view:
By default, covered code is green, covered code in a global context is blue, and code not covered is red. You can specify your color preferences for the colorization of covered and missed blocks as follows:
The information displayed in the Code Coverage view and the colorization of the editor reflect the state of the application at the time it was executed to produce that specific coverage results file. If you then make a change in the code and compile it, this might move the code in the editor. As a result, the colorization in the editor might not accurately match the information displayed in the Code Coverage view. The data displayed in the Code Coverage View will still reflect the historical state of the program when the data was generated.
Other situations where the colorization in the editor might not accurately represent the information in the code coverage view include:
To import the code coverage information from an existing .tcz results file:
This imports the code coverage statistics from the .tcz file into the Code Coverage view and adds colorization to your source files indicating the missed and the covered blocks.
Situations in which this behavior might occur are:
Also, when importing code coverage results for remote projects that no longer belong to your workspace, unexecuted programs are no longer displayed in the results.
After making changes to your application, to rerun the application with code coverage results:
This starts the application.
To delete the coverage results currently displayed in the Code Coverage view:
To delete all code coverage results:
You can merge the results file from different executions with code coverage. This provides combined statistics of running the application in different scenarios. To merge the results:
This creates a new results file that includes the combined statistics and opens it in the Code Coverage view.
Enterprise Developer preserves the history of the previous results of running the application with code coverage.
Click (Manage History) to view and load the statistics from previous runs with code coverage, to remove previous results, or to configure how many items are preserved in the history.
The Code Coverage view displays information about any programs that were not executed. Click (Show Unexecuted Program Information) to toggle the display of unexecuted programs.
When in the coverage per files view, you can filter out files from the display list that do not contain statements that are covered. To filter files, click (Show Files with no Statements) to toggle the display of files containing no statements. By default, filtering is not applied.
By default, the code coverage is linked with the editor. Double-click the element in the Code Coverage tab to open the file in the appropriate editor. Click (Link with Editor) to toggle the link between the Code Coverage tab and the editor.
To filter the rows displayed in either view, type a string in the search filter field in the Code Coverage tab. The filter is case insensitive if all characters entered are lowercase; if any of the characters entered are uppercase, the filter is case sensitive. You can use the "?" wildcard character to match a single character and the "*" to match any number of characters. By default, no filtering is applied.