Code Coverage Receiver
Code Coverage Receiver
Revi si o
Dat e Ame n d e d Na m e De s c r i p t i o n
n
1 June 23 rd 2016 T. Aube r t Initial version
2 Sept. 12 th 2016 T. Aube r t Add the xml files desc ri p tio n
Bash e e r
5 April 12 th 2021 R21 AMR review
Aham e d
2
Cod e Cover a g e Rec eive r
Copyri g h t
Pleas e includ e your na m e , comp a n y, addr e s s, and telep h o n e and fax num b e r s , and email add r e s s if
applica bl e. TAFJdev@t e m e n o s . c o m
Intro d u c ti o n
The Code Cover a g e Receiver (ccr) is a stan d a lo n e prog r a m which will rec eive infor m a t io n s via TCP from
differ e n t runnin g JBC code. This progr a m is able to gene r a t e full html repo r t . It can be man a g e d via a
web inte rf a c e as well as via com m a n d lines. The ccr can be configu r e d to rec eive infor m a t io n s from
differ e n t versions on the JBC.
To crea t e an insta n c e
ccr (.bat) cre at e <inst a n c e_ n a m e > <t c p port > [“sta r t ”]
exa m pl e : ccr cre a t e Test 12345 sta r t
If you ommit the sta rt at the end, the inst a n c e is crea t e d but not sta rt e d . You can star t / stop and
inst a n c e like this :
To start an insta n c e
ccr (.bat) star t <inst a n c e nam e)
exa m pl e : ccr star t Test
4
Cod e Cover a g e Rec eive r
To stop an insta n c e
ccr (.bat) stop <ins t a n c e nam e >
exa m pl e : ccr stop Test
To delet e an insta n c e
ccr (.bat) delet e <ins t a n c e nam e >
exa m pl e : ccr delet e Test
To res e t an inst a n c e
ccr (.bat) rese t <ins t a n c e_ n a m e >
Reset ti n g an insta n c e mea n s cleari n g all dat a rec eive d so far (star ti n g fresh).
To crea t e a repor t
ccr (.bat) make <i ns t a n c e nam e > [-p < p a t h of preco m p il e > ] [-s < p a t h of sourc e s > ] [-d < r e p o r t
destin a ti o n pat h > ]
The pat h of preco m pil e is the pat h cont aini n g all the preco m pil e jars. If it is omitt e d, the Code Cover a g e
Receive r will obviously know nothin g about the subro u ti n e s not having bee n exec ut e d , and the
subr o u t i n e cover a g e ration will always be 100%. Howeve r, the line cover a g e will be corr e c t .
If the <p a t h of sourc e s > is omitt e d, the repo r t won't be able to drill down until the sourc e s (not a big
deal for man a g e m e n t repor ti n g)
If the <r e p o r t destin a t io n pat h > is omitt e d, the repo r t will be crea t e d in the defa ult location :
<h o m e_of_cc r > / d a t a / < i n s t a n c e nam e > / r e p o r t
Note : Crea ti n g a repo r t is time consu mi n g , and it can easily take up to 1- 5 minut e s depe n di n g your
machi n e . Be patie n t !
At the root of your Code Cover a g e Receive r, you will find a file “CCRec eive r . p r o p e r t i e s”.
This file cont ai n s few inform a t i o n s to make the serve r run nin g :
http_po r t = 7470
inst a n c e s = Test;r u n ni n g
vm_op t i o n s is the java VM options used when sta rti n g the rec eive r .
Pleas e consul t the inter n e t for more options.
htt p_p or t is the main port for all the Receive r. You can chan g e it withou t any probl e m , but make sure
your serve r is stopp e d othe r wi s e you won't have any othe r choice to “kill” it.
eac h inst a n c e is suppo s e d to have its corre s p o n di n g <i ns t a n c e > direc t o r y in which you will find
<ins t a n c e > . p r o p e r t y file as well as othe r resou r c e s .
There is no need to configu r e anythi n g. The default values are all right for a nor m al activity.
6
Cod e Cover a g e Rec eive r
Usi n g th e UI
This is possibl e to man a g e your receive r via a web interfa c e . For that, open a brows e r a brows e :
http:// < i p_of_cc r > : < h t t p_ p o r t > / C ov e r a g e R e c e i v e r
At that stag e,
you can only
Shut do w n the
rec eive r or
crea t e a new
inst a n c e .
Let's click on “New Inst a n c e ...”
A very simple wizar d will guide you throu g h the insta n c e crea tio n. Small note : press <t a b > after having
typed som e t hi n g for activatin g the naviga tion s but ton s.
Everyt hi n g is persi st e d , so if you shut down the Receive r and rest a r t if after w a r d s , it will rem ai n in the
exact sam e stat u s as when you stopp e d it.
8
Cod e Cover a g e Rec eive r
The inc o n s i s t e n c i e s
As you can see on the previou s scre e n- shot s, an insta n c e can be eithe r “runni n g” or “stop p e d”, but the
side- icons are showin g thr e e stat e s.
The secon d stat e indicat e s that ther e are som e inconsist e n ci e s in the data receive d (or loade d).
This is the “war ni n g” stat e :
To unde r s t a n d wha t it mea n s, you nee d to unde r s t a n d how it is all worki ng.
At the runti m e side (whe n you run your jBC code), ther e is a speci al proc e ss which collects the line
exec ut e d and send the m in regul a r basis to the Code Cover a g e Receive r. Alongsi de with the line
num b e r s , the r e are 3 othe r inform a t i o n s sent :
1) The Subro u ti n e nam e.
2) The total num b e r of lines in this subro u t i n e s
3) The $PACKAGE inform a ti o n.
The first one is obvious. The secon d one is her e to be able to gen e r a t e a repo r t even if you are not
specifying a preco m pil e direct o ry. Howeve r, imagi n e that you run a first time you prog r a m , the Receive r
receive s a cert ai n total num b e r of lines, the n you modify the progr a m and re- run it withou t rese t t i n g the
inst a n c e .
In that case, we have an inconsi st e n c y. The repor t will cert ai nly be wron g. Fort u n a t e ly, we can see thes e
inconsist e n ci e s (see the “repo r t” chap t e r late r in this docu m e n t ).
The situa tio n is the sam e with the $PACKAGE infor m a t io n. You will see that in the repor t , the dat a are
orga niz e d by “module” / “com po n e n t ” . If, in the sam e inst a n c e , we receive 2 time s the sam e routi n e with
a differ e n t packa g e , this crea t e an “incon sis t e n c y”.
Re m o t e ma n a g e m e n t by co m m a n d lin e
Since this is possible to man a g e a Code Cover a g e Receive r rem o t ely with the UI, this is also possible to
do it com m a n d line.
All the com m a n d s (exept star t) can have the “host:po r t ” inform a ti o n as a prefix.
Exam pl e : to add an insta n c e on a rem ot e machi n e (runni n g ccr !), you can type :
ccr rem o t e_ip:r e m o t e_ po r t cre a t e insta n c e_n a m e port
Exam pl e :
The only com m a n d which cannot have a rem ot e ip addr e s s is “sta r t”. This see m s obvious. Howeve r, we
can do som e t hi n g like this :
$ccr localhost:7480 start
This will sta rt the Code Cover a g e Receive r on the port 7480.
In othe r words, for the star t com m a n d , the host “localhos t ” is force d.
Here is the full syntaxe s of all the availabl e com m a n d s
[…] mea n s “option al”
<... > mea n s “any” value
“...” me a n s a “strict” value
Start the receiver :
ccr [“localhost”:<ip>] start
Shutdown the receiver :
ccr [<host>:<ip>] shutdown
Return the status of all (or a single) instance :
ccr [<host>:<ip>] status [<instance name>]
List all the instances names :
ccr [<host>:<ip>] instances
Create a new Instance :
ccr [<host>:<ip>] create <instance name> <instance_port> [“start”]
Delete an instance :
ccr [<host>:<ip>] delete <instance name>
Reset an instance (clear the collected data) :
ccr [<host>:<ip>] reset <instance name>
Start an instance :
ccr [<host>:<ip>] start <instance name>
Stop an instance :
ccr [<host>:<ip>] stop <instance name>
Generate a report (can take few minutes) :
ccr [<host>:<ip>] make <instance name> [p <precompile dir>] [s <source dir>] [d
<destination dir>]
10
Cod e Cover a g e Rec eive r
The rep or t
Once the repo r t is gene r a t e d (eithe r by com m a n d line with the “make” option or from the UI, you will
have a “repor t” direc t o ry cont ai ni n g “static” html page s.
This repor t is comple t ely deta c h e d of anyt hi n g and can be moved to a new mac hin e.
Also, a zip file of the “repo r t ” direct o ry is gen e r a t e d at the sam e time to make a downlo a d easi e r.
From the UI (Brows e r ) per sp e c t ive, the links to the repor t (for imm e di a t e consult a ti o n) and to the zip (for
downloa d) appe a r s as show n her e :
The zip file can be downloa d e d from com m a n d line with the wget progr a m . The url is
http:// < h o s t > : < p o r t > / C o v e r a g e R e c e i v e r / d o w nl o a d/ < i n s t a n c e nam e > / r e p o r t . zi p
eg :
http://localho s t : 7 4 7 0/ C ov e r a g e R e c e i v e r/ d o w nl o a d/ m yI n s t a n c e / r e p o r t . zi p
The repo r t url (if gene r a t e d in default location) is :
http:// < h o s t > : < p o r t > / r e p o r t / < i n s t a n c e nam e > / r e p o r t / i n d e x. h t m l
The welco m e page will give an inst a n t view on the cover a g e as follows :
No t e : For the purpos e of the docu m e n t a ti o n, the report has bee n base d on a full com po n e n t build of T24
(runni n g all the unitT e s t s). The n, the report has bee n gene ra t e d passi ng AN OLDER version of the
preco m p il e d jars to force som e inconsist e n ci e s .
You can see that this repor t has som e inconsist e n c i e s. By clicking on the “<click for full list > , you will
see all the inconsist e n c i e s. Pleas e rea d the “inconsi st e n ci e s ” cha pt e r for more det ails.
12
Cod e Cover a g e Rec eive r
The repo r t details
The repo r t is orga niz e d by modul e / compo n e n t / subro u ti n e s.
Here are the differ e n t view you will have :
The “full” initial view :
All the
compo n e n t s
One compo n e n t :
One routi n e:
14
Cod e Cover a g e Rec eive r
XML files
In addition to the static html files com posi n g the repor t , you can find a subdi r e c t o r y called “xml”. This
direct o ry cont ain s xml files repr e s e n t i n g the cover a g e inform a ti o n by modul e / com po n e n t .
Here is an exam pl e of the “modul e” files :
and her e an
exam pl e of the
“com po n e n t ”
files :