今天我正在运行我的测试,但测试失败了:
tests\common\businesslogic\xxx\xxlogictest::testinvalidxx with data set #9 ([['dsadsa', 'dsafsdfsd', 1234.23, -1234.23, '', 'dsadsa']]) failed asserting that 1 matches expected 0. /var/www/html/tests/common/businesslogic/asfalistiko/formsectionelogictest.php:102 /var/www/html/tests/common/businesslogic/xxx/xxlogictest.php:301
我尝试调试这个问题,但我的数据集中有很多数据。失败的情况仅适用于特定的数据集,我需要仅使用特定的数据集(数据集 #9)运行失败的测试 testinvalidxx。
为了做到这一点,我启动了 phpunit,如下所示:
./vendor/bin/phpunit ./tests/common/businesslogic/xxx/xxlogictest.php --filter="testinvalidxx#9"
在上面的命令中,请注意提供的 --filter 值。过滤值为:
testInvalidXX#9
过滤值由2部分组成:
通过使用此过滤器,phpunit 将仅运行数据集索引 #9 的指定测试用例,让您可以专注于调试特定的失败。
本教程应该帮助您使用 phpunit 对特定数据集索引运行特定测试。
立即学习“PHP免费学习笔记(深入)”;
以上就是如何使用特定数据集运行 phpunit 单元测试的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号