Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 May 2008 at 04:10 UTC
Updated:
24 Apr 2012 at 05:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
vladimir.dolgopolov commentedInstruction:
0) enable xdebug php extension.
1) enable php_coverage module from php_coverage.zip. It's without comments, sorry.
2) edit this lines in php_coverage.module:
There should be absolute paths.
This files are created automatically and they don't need after running tests.
This files hold settings and a coverage data between subrequests.
3) edit setings in admin/settings/testing. Set 'Include paths' and 'Exclude paths' as you wish. One path for one line, relative to the Drupal root.
4) apply the patch php_coverage.patch
5) go to admin/build/testing (Testing) and run one test (Block functionality eg.)
6) go to admin/build/testing/coverage (Coverage report).
Here you can see a list of covered files (coverage_report.png).
If you click a file you'll see a code coverage report for the file (coverage_file.png).
Advantages:
1) this code coverage handles subrequests' coverages like $this->drupalPost();
2) a highlight php code capability
3) this is not depended on external stuff
Comment #2
vladimir.dolgopolov commentedThere are fullsize screenshots so you can see it.
Comment #3
vladimir.dolgopolov commentedIt seems I should change "status".
Comment #4
gábor hojtsySo you intend to have this submodule as part of the Drupal 7 distribution itself? Would it be still possible to just release it as a contributed module if it is not found suitable for Drupal 7 core?
Comment #5
dries commentedVladimir, in Drupal we don't capitalize each word in a sentence such as a title. We write "PHP code coverage", not "PHP Code Coverage". See the coding standards. There are violations of this in nearly all screenshots. It should be easy to fix though.
Comment #6
dries commentedAlso, the patch for Simpletest needs code comments.
Otherwise looks exciting! :)
Comment #7
dries commentedSimpletest is now part of Drupal core so you might want to change the project from 'SimpleTest' to 'Drupal'.
Comment #8
boombatower commentedMoving.
Comment #9
boombatower commentedWhat are the status of these two attempts in relation to each other.
http://drupal.org/node/252292
Comment #10
catchThis looks really, really nice. Subscribing so I can test when it's back to CNR.
Comment #11
vladimir.dolgopolov commentedThanks to all for the interest and advice.
I've merged the simpletest module and the previous stuff.
Let's look how it works now.
Now if you have XDebug enabled then there are 2 tabs: "Test lists" and "Coverage report".
You can now make XDebug code coverage setup in admin/settings/testing.
Added comments, some UI tuning.
Updated screenshots in http://drupal.org/node/260032#comment-849004.
By default the code coverage disabled.
The "Instruction" from http://drupal.org/node/260032#comment-848868 is almost needless.
Comment #12
catchcwgordon's got a module using a similar approach at http://drupal.org/project/code_coverage - it'd be good to have this in testing.module though.
Comment #13
cwgordon7 commentedI actually disagree - I think it belongs in a separate module, and thus can continue to live there. If there's one thing we actually would need testing.module for, it's re-introducing hook_simpletest(now hook_testing) to act before and after tests.
Comment #14
moshe weitzman commentedNice work. I'd also like to see an independant module that may or may not be distributed with simpletest. Code coverage is useful outside of simpletest actually. We should be able to do a code coverage report on any page, not just simpletest. This is very important when tuning the bootstrap and thinning our modules to take advantage of code registry.
Comment #15
boombatower commentedThis has been completed using module and #14 has separate issue #287264: Remove simpletest dependancy
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
cloudbull commentedHi there, how's going with this php_coverage finally ???
Where does it go ??
Keith