To run code coverage in headless mode using the code coverage collector, start
the collector and run the application with settings specified to connect to the code coverage
daemon. The daemon listens on one or more ports, waiting for incoming code coverage
sessions.
Before you begin
Notes:
- The headless code coverage collector on Windows and Linux is deprecated. Use the headless code
coverage collector on z/OS.
- The headless code coverage collector is not available on macOS.
- By default, results are stored in the home directory of the user that started the headless code
coverage collector in a directory called CC. This location can be overridden by
using the
-o,output parameter. For a syntax diagram and a complete list of options,
see Starting and stopping the headless code coverage collector.
Procedure
- Start the headless code coverage collector. The code coverage daemon starts
and assigns a port number. The console displays the output directory of the code coverage results
via message CRRDG7167I, the port via message CRRDG7026, and the process ID of the collector via
message CRRD7027. Then, the daemon waits for a connection.
> codecov -startdaemon
Note:
- You can specify a port number or a range of port numbers with
-p,port:
codecov -startdaemon -port=8009 or codecov -d -p=8009-8109.
- If you are running headless code coverage on Windows or Linux, the executables are in the
headless-cc subdirectory where you installed the product.
- If you are running headless code coverage on z/OS®, use
the
ccstart.sh script in
/usr/lpp/IBM/debug/headless-code-coverage/bin/ directly to start a code
coverage daemon.
- You can start multiple daemons each having different options, so long as unique port numbers are
used.
- Configure for code coverage with either a debug profile or the
TEST runtime option:
- Start the application. When code coverage is completed, a message is displayed to indicate the
results of the code coverage run.
- To stop the code coverage daemon, specify
> codecov
-stopdaemon=<port>. For example, to stop the code coverage daemon running on port 8009,
specify > codecov -D=<port>. If you are using headless code coverage on z/OS, you can use the ccstop.sh script in
/usr/lpp/IBM/debug/headless-code-coverage/bin/.
Note: You can also stop the code coverage daemon by pressing
ctrl-c or
ctrl-break on the command line. When running
headless code coverage
collector on Windows or Linux, stopping the daemon with this method skips the cleanup function and
might result in working directories in the output directory. The working directories that appear as
folders with long numbers as the names can be safely deleted when no code coverage daemon is
running. On z/OS. the working directory is in the user’s home directory with the following format:
<homedir>/<.username>/EQACC/<codecoverage_version>/workspace
Is
it highly recommended that you review the security options available for usage with the headless code coverage
collector. See Security Options for the Headless Code Coverage Collector