今天我正在运行测试,但测试失败了:
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 对特定数据集索引运行特定测试。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3