phpunit --debug still displays only dots
Solution 1
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.
Solution 2
You want to be using --testdox
phpunit --testdox
Solution 3
(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.
Solution 4
The best solution I find was to add logging section to your phpunit.xml file
<logging>
<log type="testdox-text" target="php://stdout"/>
</logging>
Alex
Friends & Colleagues (in no particular order!) http://stackoverflow.com/users/956397/pithenumber http://stackoverflow.com/users/995258/stephan http://stackoverflow.com/users/2556291/alexander-von-hilchen http://stackoverflow.com/users/2560618/knorke http://stackoverflow.com/users/4172966/mht
Updated on July 09, 2022Comments
-
Alex almost 2 years
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?
-
Alex almost 11 yearsThe point is that on other systems
--debug
used to work well ... But those was Magento/EcomDev_PHPUnit, no I am on Symfony2 - maybe it came not directly from PHPUnit? no clue ... -
Pacerier over 8 years@Darren, Wouldn't "delayed output" be considered to be a bug?
-
Darren Cook over 8 years@Pacerier I don't know. Output buffering is probably there to enable some important phpunit feature. I think if you write your own test listener class then there should be no delay (but if there was a delay on the
startTest
hook then that would count as a bug). -
b01 over 6 yearsFor clarification, When I set this in my PHPUnit configuration file, this prevents the default dot progress and uses only the logging specified in the configuration file.
-
Tim Malone over 6 yearsThis is the correct answer - and should be upvoted more! (perhaps the others used to be correct?)
-
SeanJA almost 6 yearsThe problem with
--testdox
(at least in my experience...) is that it doesn't display the errors at the bottom of the test run like the other ones, so you have to scan up and look for empty[ ]
s -
Janne Annala almost 5 years@SeanJA And if you have skipped tests, they are also displayed as empty
[ ]
so using--testdox
it will be impossible to know which tests failed. -
Ian Dunn almost 3 yearsThis gives a
Unknown option "--tap"
error inv9.5