Merging and exporting code coverage results from z/OS

When you use headless code coverage on z/OS as part of a build or run individual tests, you can use the ccexport.sh script to merge and export multiple code coverage results into a single file.

About this task

By default, a code coverage result file (*.cczip) is generated, but ccexport.sh also supports merging and exporting results into additional formats:
  • Cobertura (*.xml)
  • SonarQube (*.xml)
  • Portable Document Format (*.pdf)
You can find the ccexport.sh file in directory /usr/lpp/IBM/debug/headless-code-coverage/bin/.

Procedure

  1. Collect file names, or directories that contain code coverage results.
    Tip: If you are collecting code coverage as part of a build, you can generate all the session results in a same directory by explicitly specifying the -o,output parameter when starting the headless code coverage daemon.
  2. Run the ccexport.sh command from z/OS Unix.
    ccexport.sh example
    The syntax diagram for ccexport.sh command is shown below. You can use either the single letter parameter or the complete one for each option. All parameters and values are case-sensitive .
    Read syntax diagramSkip visual syntax diagram-ccexport.sh -h,help-p,path=<paths>-o,outputpath=<path> -r,recursive=TRUE|FALSE-n,outputfilename=<string>-e,exportertype=<CCSONARQUBE|SQ|CCPDF|PDF|CCCOBERTURA|COB>-G,exportencoding=<encoding>
    Options list
    Format: ccexport.sh [options]
    -p,path=<paths>
    Specifies a directory or a path to a results (*.cczip) file.
    If a directory is specified, all the *.cczip files in the directory are included.
    You can specify more than one path by using the system path separator between values. On z/OS, the path separator is colon (:).
    -r,recursive=TRUE|FALSE
    Optional: Indicates that any directory specified should be recursively searched one level for subdirectories with results.
    -o,outputpath=<path>
    Specifies the directory to save the merged code coverage result. A merged result with a timestamp is created under the output directory. A subdirectory is created when you export the result in the SonarQube or Cobertura format.
    -n,outputfilename=<string>
    Optional: Specifies a name for the file to use for the export operation.
    -e,exportertype=<CCSONARQUBE|SQ|CCPDF|PDF|CCCOBERTURA|COB>
    Optional: Specifies additional export formats for code coverage data. You can specify multiple export types by using a comma to separate.
    • CCSONARQUBE or SQ produces the SonarQube format with the .xml extension. A subdirectory is created when you use an exporter to produce the SonarQube format.
    • CCPDF or PDF produces the PDF format with the .pdf extension.
    • CCCOBERTURA or COB produces the Cobertura format with the .xml extension. A subdirectory is created when you use an exporter to produce the Cobertura format.
    -G,exportencoding=<encoding>
    Optional: Specifies an encoding for source when you export in the SonarQube format. By default, UTF-8 is specified.
    This parameter is valid only when -e,exportertype=CCSONARQUBE is specified.
    -h,help
    Prints the help screen.