CodeCoverageReceiver
CodeCoverageReceiver
R24
Revisio
Date Amended Name Description
n
1 June 23rd 2016 T. Aubert Initial version
2 Sept. 12th 2016 T. Aubert Add the xml files description
Basheer
5 April 12th 2021 R21 AMR review
Ahamed
H. Sanofar
8 March 6th 2024 R24 AMR Review
Nisha
Copyright
Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. [email protected]
Table of Contents
Document History................................................................................................................... 2
Copyright................................................................................................................................ 3
Errata and Comments............................................................................................................. 3
Introduction............................................................................................................................. 5
Quick start (command line)..................................................................................................... 5
To start the server..................................................................................................................... 5
To stop the server...................................................................................................................... 5
To create an instance................................................................................................................. 5
To start an instance................................................................................................................... 5
To stop an instance.................................................................................................................... 5
To delete an instance................................................................................................................. 5
To have a full status of your server............................................................................................5
To have a status of one single instance.....................................................................................5
To reset an instance................................................................................................................... 6
To create a report...................................................................................................................... 6
Very Quick start (command line)................................................................................................ 6
The code coverage configuration file.........................................................................................7
Using the UI............................................................................................................................... 8
The inconsistencies.................................................................................................................. 10
Remote management by command line..................................................................................10
Start the receiver:................................................................................................................. 11
Shutdown the receiver:......................................................................................................... 11
Return the status of all (or a single) instance:......................................................................11
List all the instances’ names:................................................................................................ 11
Create a new Instance:......................................................................................................... 11
Delete an instance:............................................................................................................... 11
Reset an instance (clear the collected data):........................................................................11
Start an instance:.................................................................................................................. 11
Stop an instance:.................................................................................................................. 11
Generate a report (can take few minutes):...........................................................................11
The report................................................................................................................................ 12
The welcome page................................................................................................................ 13
The inconsistencies view....................................................................................................... 13
The report details.................................................................................................................. 14
XML files............................................................................................................................... 17
To create an instance
ccr (.bat) create <instance_name> <tcp port> [“start”]
example: ccr create Test 12345 start
If you omit the start at the end, the instance is created but not started. You can start / stop and
instance like this:
To start an instance
ccr (.bat) start <instance name)
example: ccr start Test
To stop an instance
ccr (.bat) stop <instance name>
example: ccr stop Test
To delete an instance
ccr (.bat) delete <instance name>
example: ccr delete Test
To create a report
ccr (.bat) make <instance name> [-p <path of precompile>] [-s <path of sources>] [-d <report
destination path>]
The path of precompile is the path containing all the precompile jars. If it is omitted, the Code
Coverage Receiver will obviously know nothing about the subroutines not having been
executed, and the subroutine coverage ratio will always be 100%. However, the line coverage
will be correct.
If the <path of sources> is omitted, the report won't be able to drill down until the sources (not
a big deal for management reporting)
If the <report destination path> is omitted, the report will be created in the default location:
<home_of_ccr>/data/<instance name>/report
Note: Creating a report is time consuming, and it can easily take up to 1-5 minutes depending
on your machine.
Be patient!
Done!
At the root of your Code Coverage Receiver, you will find a file “CCReceiver.properties”.
This file contains few information to make the server running:
http_port = 7470
instances = Test;running
vm_options - is the java VM options used when starting the receiver.
Please consult the internet for more options.
http_port - is the main port for all the Receiver. You can change it without any problem, but
make sure your server is stopped otherwise you won't have any other choice to “kill” it.
Each instance is supposed to have its corresponding <instance> directory in which you will find
<instance>.property file as well as other resources.
There is no need to configure anything. The default values are all right for a normal activity.
Using the UI
This is possible to manage your receiver via a web interface. For that, open a browser a browse:
http://<ip_of_ccr>:<http_port>/CoverageReceiver
At
that stage, you can only Shutdown the receiver or create a new instance.
Let's click on “New Instance ...”
A very simple wizard will guide you through the instance creation. Small note: press <tab> after
having typed something for activating the navigations buttons.
Once you clicked finished, your main screen will look like this:
If
you read the “Quick start (command line)” chapter, you will recognize all the options on your
screen. No need to comment them again here.
Everything is persisted, so if you shut down the Receiver and restart if afterwards, it will remain
in the exact same status as when you stopped it.
The inconsistencies
As you can see on the previous screenshots, an instance can be either “running” or “stopped”,
but the side-icons are showing three states.
The second state indicates that there are some inconsistencies in the data received (or loaded).
This is the “warning” state!
The first one is obvious. The second one is here to be able to generate a report even if you are
not specifying a precompile directory. However, imagine that you run a first time you program,
the Receiver receives a certain total number of lines, then you modify the program and re-run it
without resetting the instance.
In that case, we have an inconsistency. The report will certainly be wrong. Fortunately, we can
see these inconsistencies (see the “report” chapter later in this document).
The situation is the same with the $PACKAGE information. You will see that in the report, the
data are organized by “module” / “component”. If, in the same instance, we receive 2 times the
same routine with a different package, this creates an “inconsistency”.
Since this is possible to manage a Code Coverage Receiver remotely with the UI, this is also
possible to do it command line.
All the commands (except start) can have the “host:port” information as a prefix.
Example: to add an instance on a remote machine (running ccr!), you can type:
ccr remote_ip:remote_port create instance_name port
Example:
$ccr 10.41.5.51:7470 create myNewInstance 1212
The only command which cannot have a remote ip address is “start”. This seems obvious.
However, we can do something like this:
$ccr localhost:7480 start
This will start the Code Coverage Receiver on the port 7480.
In other words, for the start command, the host “localhost” is forced.
Here is the full syntaxes of all the available commands
[…] means “optional”
<...> means “any” value
“...” means a “strict” value
Delete an instance:
ccr [<host>:<ip>] delete <instance name>
Start an instance:
ccr [<host>:<ip>] start <instance name>
Stop an instance:
ccr [<host>:<ip>] stop <instance name>
The report
Once the report is generated (either by command line with the “make” option or from the UI,
you will have a “report” directory containing “static” html pages.
This report is completely detached of anything and can be moved to a new machine.
Also, a zip file of the “report” directory is generated at the same time to make a download
easier.
From the UI (Browser) perspective, the links to the report (for immediate consultation) and to
the zip (for download) appears as shown here:
The zip file can be downloaded from command line with the wget program. The url is:
http://<host>:<port>/CoverageReceiver/download/<instance name>/report.zip
eg :
http://localhost:7470/CoverageReceiver/download/myInstance/report.zip
The report url (if generated in default location) is:
http://<host>:<port>/report/<instance name>/report/index.html
The welcome page will give an instant view on the coverage as follows:
Note: For the purpose of the documentation, the report has been based on a full component
build of T24 (running all the unit tests). Then, the report has been generated passing AN OLDER
version of the precompiled jars to force some inconsistencies.
You can see that this report has some inconsistencies. By clicking on the “<click for full list>,
you will see all the inconsistencies. Please read the “inconsistencies” chapter for more details.
One component:
One routine:
XML files
In addition to the static html files composing the report, you can find a subdirectory called
“xml”. This directory contains xml files representing the coverage information by module /
component.
Here is an example of the “module” files: