我想看看在phpunit运行期间当前执行的是哪个测试。
我使用--debug
参数,但仍然只得到点:
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>
这可能是什么原因?
您希望使用——testdox
phpunit)——testdox
(回答"如何查看当前正在运行的测试"的问题)
如您所见,——debug和——verbose没有多大帮助。(大多数时候我使用——verbose,但因为它在出错时告诉我更多的信息,并且在其他时候不是很冗长。)
这是我的第一次尝试:
phpunit --verbose --tap
我在一个测试套件上进行了测试,该套件有一些较慢的测试。它在测试21之前工作得很好,然后什么也没有,然后几分钟后测试22到598一次出现。我怀疑是输出缓冲。下面是一个没有这个问题的变体,但需要打开两个终端窗口:
phpunit --verbose --log-tap tap.log
然后在另一个窗口:
tail -f tap.log
实际上它并没有确切地告诉你你想要什么,因为它只报告它正在工作的函数。因此,当您得到延迟时,您必须等待测试完成才能发现哪个是慢测试。
要获得更多的控制,可以考虑编写自己的测试侦听器
我有同样的问题,并通过删除这个来解决它:
printerClass="PHPUnit_TextUI_ResultPrinter"
我发现最好的解决方案是在phpunit.xml文件中添加日志记录部分
<logging>
<log type="testdox-text" target="php://stdout"/>
</logging>