code coverage analysis and phpstorm 7?

I just managed to get phpunit on server all running nicely and it is time to figure out how to get coverage statistics.
I can add testrunner commands to make the files generate on the remote server, that I understand. I just need to know what to do with them afterewards to bring it into phpstorm.

What kind of coverage file does phpstorm expect?
where does it expect to find said file or files?

Be at ease,
Kristopher.

4 comments

Hi there,

Code Coverage for "PHPUnit on Server" Run/Debug configuration is not implemented yet: http://youtrack.jetbrains.com/issue/WI-9903

I just need to know what to do with them afterewards to bring it into phpstorm.

1. Transfer it (clover coverage xml report file) to local computer (or .. you can access them directly, as long as remote location is mapped to a drive letter)

2. In PhpStorm use "Tools | Show Code Coverage Data" and point to that clover-coverage.xml file (file name can be anything)

3. The file gets cached -- so if you just refresh the file (e.g. overwrite old report with new one) it will not be picked up by IDE (possibly it was fixed, but I doubt that it was done for such manual scenario -- only for automated local). This means -- when you in that screen, you need to remove old file and then add it again in order for IDE to see new coverage data (otherwise cached/old data is used). Possibly (just possibly -- I'm too lazy to set it up and test it myself) it even requires using this screen twice: 1) remove file and close (old data is removed) 2) add new file (the same location) -- file gets re-read so new data is used.

P.S.
Please note that since I'm doing local PHPUnit testing, I have no need to use that screen manually, and all above is based on my past experience, which is about 2 years old by now.

0

So I pulled over my clover.xml file which is my code coverage stats file, and used the coverage window to open it.

I get a coverage tab with a file tree in it and I can navigate around in it,

but all of my statistics are blank. Shouldn't I see a percentage at some point for some item?

I've gone to fine classes I know have coverage near 90% and they still show nothing in the coverage window.

Additionally, I am missing a bunch of buttons that the help page lists (export results) etc.

0
but all of my statistics are blank. Shouldn't I see a percentage at some point for some item?

Most likely (99.99% IMO) that's because you have your server paths in your coverage.xml while IDE works with local (project) paths only. You need to somehow convert (replace) your remote paths with local ones (Find | Replace ?). I've completely forgotten about this step (for me it was unnecessary as local and remote were the same).

Additionally, I am missing a bunch of buttons that the help page lists (export results) etc.

If you could show me the screenshots of what you see and what you think you should have .. I may compare it to what I see here. It's possible (although rather unlikely) that doc was copied from IntelliJ while PhpStorm does not have those buttons/functionality implemented yet.

0

you were right, my file paths needed to be changed. But once I did that I got a nice percentage in the coverage window and I now have it showing up in my editor window as well,
Awesome, thanks!

Be well,
Kristopher.

0

Please sign in to leave a comment.