phpunit --debug仍然只显示点

Ale*_*lex 35 php phpunit symfony

我想看看在phpunit运行期间当前执行了哪个测试.

我使用--debug参数但仍然只得到点:

$ phpunit --debug 
PHPUnit 3.7.19 by Sebastian Bergmann.

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

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

内容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>
Run Code Online (Sandbox Code Playgroud)

这可能是什么原因?

小智 44

你想要使用--testdox

phpunit --testdox

  • `--testdox`(至少根据我的经验......)的问题是它不像其他的那样在测试运行的底部显示错误,所以你必须扫描并寻找空的` []`s (3认同)

Dar*_*ook 22

(回答"如何查看当前正在运行的测试"的问题)

正如你所注意的那样--debug和--verbose没什么帮助.(我大部分时间都使用--verbose,但因为它在出现问题时会告诉我更多信息,而其余时间并不是非常冗长.)

这是我的第一次尝试:

phpunit --verbose --tap
Run Code Online (Sandbox Code Playgroud)

我试用了一个测试套件,它有一些慢速测试.它工作得很漂亮,直到测试21,然后没有,然后几分钟后测试22到598一次出现.我怀疑输出缓冲.这是一个没有此问题的变体,但需要打开两个终端窗口:

phpunit --verbose --log-tap tap.log
Run Code Online (Sandbox Code Playgroud)

然后在另一个窗口:

tail -f tap.log
Run Code Online (Sandbox Code Playgroud)

实际上它并没有告诉你你想要什么,因为它只报告它正在处理的功能.所以,当你得到延迟时,你必须等待测试结束才能发现哪个是慢速测试.

为了获得更多控制,请考虑编写自己的测试监听器.

  • 这会在“v9.5”中出现“未知选项“--tap””错误 (2认同)

Ger*_*erg 12

我遇到了同样的问题并通过删除它来解决它:

printerClass="PHPUnit_TextUI_ResultPrinter"
Run Code Online (Sandbox Code Playgroud)

来自phpunit.xml配置文件中基本标记的选项.


Yev*_*yev 6

我找到的最佳解决方案是将日志记录部分添加到您的 phpunit.xml 文件中

<logging>
    <log type="testdox-text" target="php://stdout"/>
</logging>
Run Code Online (Sandbox Code Playgroud)