42
votes

I want to see which test is currently executed during a phpunit run.

I use the --debug param but still only get dots:

$ phpunit --debug 
PHPUnit 3.7.19 by Sebastian Bergmann.

Configuration read from /home/foo/bar/phpunit.xml

..S.......I..

contents of phpunit.xml:

<phpunit backupGlobals="true"
     bootstrap="tests/bootstrap.php"
     backupStaticAttributes="false"
     cacheTokens="false"
     colors="true"
     convertErrorsToExceptions="true"
     convertNoticesToExceptions="true"
     convertWarningsToExceptions="true"
     forceCoversAnnotation="false"
     mapTestClassNameToCoveredClassName="false"
     printerClass="PHPUnit_TextUI_ResultPrinter"
     processIsolation="false"
     stopOnError="false"
     stopOnFailure="false"
     stopOnIncomplete="false"
     stopOnSkipped="false"
     testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
     strict="false"
     verbose="true">
    <testsuites>
    <testsuite name="foo Tests">
        <directory>./tests</directory>
    </testsuite>
    </testsuites>
    <filter>
    <whitelist addUncoveredFilesFromWhitelist="true">
        <directory suffix=".php">./src</directory>
    </whitelist>
    </filter>
    <logging>
    <log type="coverage-clover" target="./clover.xml"/>
    </logging>
</phpunit>

What can be the reason for this?

4
Aren't you looking for --verbose instead? - Denis de Bernardy
You'd want to rephrase the question, then, as it's unclear what you want. (The list of switches is here, btw: phpunit.de/manual/3.6/en/textui.html) - Denis de Bernardy
@Denis, verbose is already true in his phpunit.xml - Mick
In PHPUNIT 4.8.30 (and up, presumably), --debug works for this. - Kzqai
I would have phrased this "How do I stop the default dot progress output when running PHPUnit test?" - b01

4 Answers

14
votes

I had the same problem and resolved it by removing this:

printerClass="PHPUnit_TextUI_ResultPrinter"

from the options on the base tag in the phpunit.xml config file.

68
votes

You want to be using --testdox

phpunit --testdox

22
votes

(Answering the question of "how to see which test is currently running")

As you've noticed --debug and --verbose are of little help. (I use --verbose most of the time, but because it tells me more information when things go wrong, and isn't really very verbose the rest of the time.)

Here was my first try:

phpunit --verbose --tap

I tried it out on a test suite that has some slow tests. It worked beautifully until test 21, then nothing, then a few minutes later tests 22 to 598 appeared in one go. I suspect output buffering. Here is a variation that does not have this problem, but requires two terminal windows open:

phpunit --verbose --log-tap tap.log

Then in another window:

tail -f tap.log

Actually it doesn't tell you exactly what you want, because it only reports which function it was working on. So, when you get a delay you have to wait for the test to finish to discover which is the slow test.

To get more control consider writing your own test listener.

6
votes

The best solution I find was to add logging section to your phpunit.xml file

<logging>
    <log type="testdox-text" target="php://stdout"/>
</logging>