我正在使用 laravel 并且我已经编写了一些测试文件。但是我怎样才能只执行一个文件呢?例如,当我这样做时:phpunit tests/resulttesting/school/deleteSchoolForRealTest
它抛出一个错误:
Cannot open file "tests/resulttesting/school/deleteSchoolForRealTest.php".
当我运行 phpunit 时,它会运行我所有的测试。我怎样才能只执行一个文件夹?我在 Mac 上。
最佳答案
你做的一切都是正确的。
1)
第一种添加文件夹的方法。 我的正确方法是:
phpunit tests/EWalletTest
当我忘记从“测试”文件夹开始时,我遇到了同样的错误
phpunit EWalletTest
我得到了
Cannot open file "EWalletTest.php".
2)
过滤器 是另一种选择。 read here 示例:
phpunit --filter EWallet
Only runs tests whose name matches the given regular expression pattern.
这意味着您将执行文件 EWalletTest
和 EWalletFooTest
以及来自其他文件的测试用例,名称如 `test_EWallet_with_Australian_dollar。
关于php - 在 phpunit 中运行一个文件或 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35596637/