Tor*_*que 5 php phpunit unit-testing
我试图让 PHPUnit 在失败时停止并按缺陷排序测试,以加快我的开发体验(没有双关语)。
这是我尝试的:我"--cache-result --order-by=defects --stop-on-defect"在命令行上使用,另外我使用phpunit.xml.dist带有这些标志的 a :
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="app/autoload.php"
cacheResult = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "true"
executionOrder = "defects"
beStrictAboutCoversAnnotation = "true"
beStrictAboutOutputDuringTests = "true"
enforceTimeLimit = "false"
>
[...]
Run Code Online (Sandbox Code Playgroud)
但我的(第二次)测试运行仍然是这样的:
[me@horus server]$ ./vendor/bin/phpunit --cache-result --order-by=defects --stop-on-defect
Runtime: PHP 7.3.10
Configuration: /home/.../phpunit.xml.dist
PHPUnit 7.5.16 by Sebastian Bergmann and contributors.
S..S........................................................... 63 / 619 ( 10%)
...SSS......................................................... 126 / 619 ( 20%)
............................................................EEE 189 / 619 ( 30%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.....................F
Time: 8.41 minutes, Memory: 483.04 MB
There were 43 errors:
[...]
Run Code Online (Sandbox Code Playgroud)
我可以看出它确实使用了我的 xml,因为当我搞乱格式时,对 PHPUnit 的调用就会失败。但为什么测试没有从第一次失败开始排序呢?为什么会出现一整串的失败,而不是只有一个E?不是应该在第一个之后就停止吗E?