Bug 13899 - Adding misc/devel/coverage.pl, a script making a cover on all modules to see which ones are not tested yet.
Summary: Adding misc/devel/coverage.pl, a script making a cover on all modules to see ...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Julian FIOL
QA Contact: Galen Charlton
URL:
Keywords:
Depends on:
Blocks: 14283
  Show dependency treegraph
 
Reported: 2015-03-24 13:04 UTC by Julian FIOL
Modified: 2016-12-05 21:23 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


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 (2.04 KB, patch)
2015-03-24 13:07 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 13899 : Adding misc/devel/coverage.pl (2.04 KB, patch)
2015-03-24 13:17 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 13899 : Add changes as asked in Comment 5 (1.93 KB, patch)
2015-04-15 12:19 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 13889 - Add information about cron jobs to system log (21.68 KB, patch)
2015-04-20 12:17 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 13899 : Changing license to GPLv3 (1.69 KB, patch)
2015-04-27 07:33 UTC, Julian FIOL
Details | Diff | Splinter Review
Bug 13899 : Changing license to GPLv3 (1.67 KB, patch)
2015-04-27 07:36 UTC, Julian FIOL
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 13899: Adding misc/devel/coverage.pl (2.11 KB, patch)
2015-05-06 16:57 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 13899: Add changes as asked in Comment 5 (2.05 KB, patch)
2015-05-06 16:57 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 13899: Changing license to GPLv3 (1.84 KB, patch)
2015-05-06 16:57 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[PASSED QA] Bug 13899: Adding misc/devel/coverage.pl (2.18 KB, patch)
2015-05-08 13:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
[PASSED QA] Bug 13899: Add changes as asked in Comment 5 (2.11 KB, patch)
2015-05-08 13:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
[PASSED QA] Bug 13899: Changing license to GPLv3 (1.89 KB, patch)
2015-05-08 13:51 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 13899: (QA followup) POD and usage message fixes (1.55 KB, patch)
2015-05-26 14:45 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!