# Code coverage testing

- Thread: https://externals.io/message/10842
- Original archive: https://news-web.php.net/php.internals/10842
- Started by Michael Luu on 2004-06-30T02:52:39+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10842 — Michael Luu — 2004-06-30T02:52:39+00:00

URL: https://externals.io/message/10842#10842

Hi all. I've started poking/hacking around in the Zend source trying
to implement code coverage statistics for php files. The end goal is
to build php with a coverage option, place it on a test server, run
test suites, then see which lines of code in which files were hit
(more importantly which ones weren't). Very similar to gcov for those
familar with gcc. Am I re-inventing the wheel? Does this already
exist?

Thanks,
Mike

---

## #10844 — George Schlossnagle — 2004-06-30T03:28:57+00:00

URL: https://externals.io/message/10842#10844 · In reply to: #10842

> Hi all. I've started poking/hacking around in the Zend source trying
> to implement code coverage statistics for php files. The end goal is
> to build php with a coverage option, place it on a test server, run
> test suites, then see which lines of code in which files were hit
> (more importantly which ones weren't). Very similar to gcov for those
> familar with gcc. Am I re-inventing the wheel? Does this already
> exist?

I believe xDebug supports this, and there's a worked example in my book.

George

---

## #10845 — Sebastian Bergmann — 2004-06-30T04:07:51+00:00

URL: https://externals.io/message/10842#10845 · In reply to: #10844

George Schlossnagle wrote:
> I believe xDebug supports this

  It does. When using PHPUnit2 with XDebug you get information about
  which lines of code are covered by which unit test, etc.

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/

---

## #10846 — Michael Luu — 2004-06-30T05:22:12+00:00

URL: https://externals.io/message/10842#10846 · In reply to: #10845

These tools are exactly what I'm looking for.

Thanks guys!

Mike

On Wed, 30 Jun 2004 06:07:51 +0200, Sebastian Bergmann
<sb@sebastian-bergmann.de> wrote:
> 
> George Schlossnagle wrote:
> > […]
> 
>   It does. When using PHPUnit2 with XDebug you get information about
>   which lines of code are covered by which unit test, etc.
> 
> --
> Sebastian Bergmann
> http://sebastian-bergmann.de/                   http://phpOpenTracker.de/
> 
> Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
