准备试用一下PHPUnit

看phpunit几点要注意的:
1. 数据提供: @dataProvider
2. 测试异常: setExpectedException (直接写try catch 再 $this->fail(); 可能写好)
3. 测试输出: PHPUnit_Extensions_OutputTestCase->expectOutputString();
4. 测试性能: PHPUnit_Extensions_PerformanceTestCase->setMaxRunningTime();
5. AllTests需要手动写。不然直接测一个目录也很好用。
6. 可以自动生成测试代码框架,或从反向生成类文件。
7. 在Netbeans里可视化地测,但没找到“远程测”。

[参考]

翻译版的袖珍指南:
http://blog.chinaunix.net/u1/57558/showart_507369.html

所有Assert翻译版:
http://blog.chinaunix.net/u1/57558/showart.php?id=523325

PHPUnit Manula:
http://www.phpunit.de/manual/3.4/en/automating-tests.html

PHPUnit Assertions:
http://www.phpunit.de/manual/3.4/en/appendixes.assertions.html

Install phpunit in xampp:
http://blog.airness.de/2008/11/12/installing-phpunit-in-xampp/

使用 PHPUnit 和 Selenium 进行测试 - Netbeans IDE 教程
http://netbeans.org/kb/docs/php/phpunit_zh_CN.html

原文地址:https://www.cnblogs.com/nonlyli/p/1698497.html