Code Coverage Receiver
Code Coverage Receiver
R18
TAFJ-U ni tT e s t F r a m e w o r k
Amendment History:
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
Page 2
CodeCoverage Receiver
Ta b l e o f C o n t e n t s
Introduction........................................................................................................................... 4
To create an instance....................................................................................................... 4
To start an instance.......................................................................................................... 4
To stop an instance.......................................................................................................... 4
To delete an instance....................................................................................................... 4
To reset an instance......................................................................................................... 5
To create a report............................................................................................................. 5
The inconsistencies.............................................................................................................. 9
The report........................................................................................................................... 11
XML files........................................................................................................................ 16
Page 3
CodeCoverage Receiver
Intro d u c ti o n
The Code Coverage Receiver (ccr) is a standalone program which will receive informations
via TCP from different running JBC code. This program is able to generate full html report. It
can be managed via a web interface as well as via command lines. The ccr can be
configured to receive informations from different versions on the JBC.
To s t a r t t h e s e r v e r
ccr (.bat) start
To s t o p t h e s e r v e r
ccr (.bat) shutdown
Once the server is started, you need to create a new instance (this is effectively what will
receive informations from your JBC programs.
To c r e a t e a n i n s t a n c e
ccr (.bat) create <instance_name> <tcp port> [“start”]
If you ommit the start at the end, the instance is created but not started. You can start / stop
and instance like this :
To s t a r t a n i n s t a n c e
ccr (.bat) start <instance name)
To s t o p a n i n s t a n c e
ccr (.bat) stop <instance name>
To d e l e t e a n i n s t a n c e
ccr (.bat) delete <instance name>
To h a v e a f u l l s t a t u s o f y o u r s e r v e r
ccr (.bat) status
Page 4
CodeCoverage Receiver
To h a v e a s t a t u s o f o n e s i n g l e i n s t a n c e
ccr (.bat) status <instance_name>
To r e s e t a n i n s t a n c e
ccr (.bat) reset <instance_name>
Resetting an instance means clearing all data received so far (starting fresh).
To c r e a t e a r e p o r t
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 ration 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 your machine. Be patient !
Very Q u i c k s t a r t ( c o m m a n d l i n e )
$ c cr m a k e myInsta n c e
Done !
T h e c o d e c o v e r a g e c o n f i g u r a t i o n fil e .
At the root of your Code Coverage Receiver, you will find a file “CCReceiver.properties”.
This file contains few informations to make the server running :
Page 5
CodeCoverage Receiver
http_port = 7470
instances = Test;running
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.
Their is no need to configure anything. The default values are all right for a normal activity.
Page 6
CodeCoverage Receiver
U si n g t h e 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.
Page 7
CodeCoverage Receiver
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.
Page 8
CodeCoverage Receiver
As you can see on the previous screen-shots, 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 create an “inconsistency”.
R e m o t e m a n a g e m e n t by c o m m a n d lin e
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 (exept 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 :
$ c cr 1 0 . 4 1 . 5. 5 1: 7 4 7 0 cr e a t e m y N e wI n s t a n c e 1 2 1 2
The only command which cannot have a remote ip address is “start”. This seems obvious.
However, we can do something like this :
$ c c r l o c a l h o s t: 7 4 8 0 s t a r t
Page 9
CodeCoverage Receiver
This will start the Code Coverage Receiver on the port 7480.
In other words, for the start command, the host “localhost” is forced.
Page 10
CodeCoverage Receiver
Th e rep ort
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
http://<host>:<port>/report/<instance name>/report/index.html
Page 11
CodeCoverage Receiver
The w elc o m e pa g e
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 unitTests). 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.
T h e i n c o n s i s t e n c i e s vi e w
Here is a view of the inconsistencies :
Page 12
CodeCoverage Receiver
Th e r e p ort d e t ail s
The report is organized by module / component / subroutines.
Page 13
CodeCoverage Receiver
Page 14
CodeCoverage Receiver
One component :
Page 15
CodeCoverage Receiver
Page 16
CodeCoverage Receiver
One routine :
X ML fil e s
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.
Page 17
CodeCoverage Receiver
Page 18