Bug 13899

Summary: Adding misc/devel/coverage.pl, a script making a cover on all modules to see which ones are not tested yet.
Product: Koha Reporter: Julian FIOL <julian.fiol>
Component: Test SuiteAssignee: Julian FIOL <julian.fiol>
Status: CLOSED FIXED QA Contact: Galen Charlton <gmcharlt>
Severity: enhancement    
Priority: P5 - low CC: bgkriegel, jonathan.druart, julian.maurice, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 14283    
Attachments: Bug 13899 : Adding misc/devel/coverage.pl, a script making a cover on all modules to see which ones are not tested yet. It uses Devel::Cover
Bug 13899 : Adding misc/devel/coverage.pl
Bug 13899 : Add changes as asked in Comment 5
Bug 13889 - Add information about cron jobs to system log
Bug 13899 : Changing license to GPLv3
Bug 13899 : Changing license to GPLv3
[SIGNED-OFF] Bug 13899: Adding misc/devel/coverage.pl
[SIGNED-OFF] Bug 13899: Add changes as asked in Comment 5
[SIGNED-OFF] Bug 13899: Changing license to GPLv3
[PASSED QA] Bug 13899: Adding misc/devel/coverage.pl
[PASSED QA] Bug 13899: Add changes as asked in Comment 5
[PASSED QA] Bug 13899: Changing license to GPLv3
Bug 13899: (QA followup) POD and usage message fixes

Description Julian FIOL 2015-03-24 13:04:06 UTC
Adding misc/devel/coverage.pl, a script making a cover on all modules to see which ones are not tested yet.

It uses Devel::Cover
Comment 1 Julian FIOL 2015-03-24 13:07:42 UTC Comment hidden (obsolete)
Comment 2 Julian FIOL 2015-03-24 13:17:10 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-04-13 09:56:46 UTC
Julian,
1/ I would suggest you to replace 
  $sth = $dbh->prepare($query);
  $sth->execute($biblionumber1, $status);
  $count = $sth->fetchrow_array;
 with a call to $dbh->selectrow_array

2/ use perltidy on new file.

3/ use the qa script to catch the trailing spaces
Comment 4 Jonathan Druart 2015-04-13 09:57:27 UTC
Sorry, wrong bug report :-/
Comment 5 Jonathan Druart 2015-04-13 10:04:58 UTC
Comment on attachment 37178 [details] [review]
Bug 13899 : Adding misc/devel/coverage.pl

Review of attachment 37178 [details] [review]:
-----------------------------------------------------------------

And please run perltidy on new files.

::: misc/devel/coverage.pl
@@ +34,5 @@
> +use C4::Context;
> +
> +my $KOHA_PATH = C4::Context->config("intranetdir");
> +
> +chdir $KOHA_PATH;

I would not do that, I'd prefer compare getcwd and intranetdir. If they differ, raise an error.

@@ +37,5 @@
> +
> +chdir $KOHA_PATH;
> +
> +eval{
> +	require Devel::Cover;

Add it to the list of deps (see C4/Installer/PerlDependencies.pm).

@@ +41,5 @@
> +	require Devel::Cover;
> +};
> +
> +if ($@) {
> +	say "Devel::Cover needs to be installed";

And don't catch the deps error.

@@ +49,5 @@
> +#Delete old coverage
> +system("cover -delete");
> +
> +#Start the cover
> +system("PERL5OPT=-MDevel::Cover /usr/bin/prove -r t/");

What about existing PERL5OPT? Have a look at prove -M
Comment 6 Julian FIOL 2015-04-15 12:19:13 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-04-20 12:17:43 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2015-04-20 12:25:03 UTC
Comment on attachment 38181 [details] [review]
Bug 13889 - Add information about cron jobs to system log

Sorryfor the noize, I mistaked with the bug number.
Comment 9 Bernardo Gonzalez Kriegel 2015-04-25 14:05:39 UTC
As Jonathan said, run koha-qa

 FAIL   misc/devel/coverage.pl
   OK     critic
   FAIL   forbidden patterns
                forbidden pattern: Koha is now under the GPLv3 license (line 8)
   OK     pod
   OK     valid
Comment 10 Julian FIOL 2015-04-27 07:33:51 UTC Comment hidden (obsolete)
Comment 11 Julian FIOL 2015-04-27 07:36:25 UTC Comment hidden (obsolete)
Comment 12 Bernardo Gonzalez Kriegel 2015-05-06 16:57:14 UTC Comment hidden (obsolete)
Comment 13 Bernardo Gonzalez Kriegel 2015-05-06 16:57:22 UTC Comment hidden (obsolete)
Comment 14 Bernardo Gonzalez Kriegel 2015-05-06 16:57:31 UTC Comment hidden (obsolete)
Comment 15 Julian FIOL 2015-05-07 07:21:50 UTC
Test Plan
---------

1. Go to your koha/src directory

2. Launch misc/devel/coverage.pl script

3. After a pretty long time it will generate an html file (path given at the end of execution). 
It something like [...]/koha/src/cover_db/coverage.html

4. This html file give you a lot of information about coverage of koha modules

I use it to see which module are not coverage by unit tests and improve it
Comment 16 Kyle M Hall (khall) 2015-05-08 13:51:27 UTC
Created attachment 38977 [details] [review]
[PASSED QA] Bug 13899: Adding misc/devel/coverage.pl

It's a script making a cover on all modules to see
which ones are not tested yet. It uses Devel::Cover

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall (khall) 2015-05-08 13:51:35 UTC
Created attachment 38978 [details] [review]
[PASSED QA] Bug 13899: Add changes as asked in Comment 5

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Fixed a small conflict on PerlDependencies.pm

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Kyle M Hall (khall) 2015-05-08 13:51:37 UTC
Created attachment 38979 [details] [review]
[PASSED QA] Bug 13899: Changing license to GPLv3

koha-qa should be good :

 OK	misc/devel/coverage.pl
   OK	  critic
   OK	  forbidden patterns
   OK	  pod
   OK	  valid

 OK	C4/Installer/PerlDependencies.pm
   OK	  critic
   OK	  forbidden patterns
   OK	  pod
   OK	  valid

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors.
Test plan not explicitly stated,
script run and generates a lot of data :)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 19 Tomás Cohen Arazi (tcohen) 2015-05-26 14:45:42 UTC
Created attachment 39531 [details] [review]
Bug 13899: (QA followup) POD and usage message fixes

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

asd
Comment 20 Tomás Cohen Arazi (tcohen) 2015-05-26 17:39:16 UTC
Tool pushed to master.

Thanks Julian!