【发布时间】:2010-09-28 07:54:57
【问题描述】:
我在集成服务器上使用 phpUnit 来运行所有测试,如果我从命令行启动 phpunit 命令,我会收到:
PHPUnit 3.2.18 by Sebastian Bergmann.
F..III..I......I.IIII...
Time: 6 seconds
There was 1 failure:
1) Warning(PHPUnit_Framework_Warning)
No tests found in class "TU".
FAILURES
Tests: 24, Failures: 1, Incomplete: 9.
通过 apache,运行相同的测试文件:
PHPUnit 3.2.18 by Sebastian Bergmann.
..III..I......I.IIII...
Time: 7 seconds
OK, but incomplete or skipped tests!
Tests: 23, Incomplete: 9.
我的 TU 课程只包括所有带有$suite->addTestFile() 的测试课程,
并且有两个静态函数:main() 运行所有测试,
和 suite() 返回测试套件。
但是 TU 类不在作为参数给出的主文件中
phpunit 命令,它是一个通用类,它扫描文件并列出所有测试
类。
我对扩展 PHPUnit_Framework_TestCase 以添加 specific assert() 的类有同样的问题,该类不包含在 $suite->addTestFile() 中,而仅包含在 require() 中。
我该如何纠正这个问题?
【问题讨论】: