PHPUnit的测试输出中的S和W是什么?

时间:2017-01-03 22:39:05

标签: php phpunit

我最近更新了Sebastian Bergmann的PHPUnit,当我尝试运行测试用例时,我将其作为输出:

...EEE.EEEEE.E.EE............EFFFE.F..FF.........SSSSSSSSSSSSSS  63 / 110 ( 57%)
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS....W.W                 110 / 110 (100%)

根据文档,我可以找到:

.   Success
E   Error
F   Failed

我不确定WS这里是什么。谁能告诉我那是什么?如果其他信息有帮助,则W为黄色,S为蓝色。

4 个答案:

答案 0 :(得分:11)

根据Docs

.   Printed when the test succeeds.
F   Printed when an assertion fails while running the test method.
E   Printed when an error occurs while running the test method.
R   Printed when the test has been marked as risky (see Chapter 6).
S   Printed when the test has been skipped (see Chapter 7).
I   Printed when the test is marked as being incomplete or not yet implemented (see Chapter 7).

根据Source Code

public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time)
{
    $this->writeProgressWithColor('fg-yellow, bold', 'W');
    $this->lastTestFailed = true;
}

黄色粗体W 用于警告。希望这能回答你的问题。

答案 1 :(得分:1)

根据documentationS代表 S kipped测试(即,由注释标记的测试意味着它们不应运行)。

答案 2 :(得分:0)

S意味着跳过,请看这里:https://phpunit.de/manual/current/en/phpunit-book.html#textui不确定W的意思,也许是“警告”?

答案 3 :(得分:0)

其他答案正在描述除W以外的所有参数。如果您使用的是Laravel,并且看到此粗体黄色W,则会测试哪个文件名与内部的类名不匹配。您需要使用--debug在一边运行所有测试。首先,您看到W显示有问题的类:

phpunit tests/ --debug