“网络界面"PHPUnit 测试? [英] "Web interface" to PHPUnit tests?
问题描述
是否有一个简单的Web 界面"来运行 PHPUnit 测试套件?即在命令行上运行测试的 PHP 脚本,并输出格式良好的 HTML 结果.
Is there a simple "Web interface" to running PHPUnit test suites? i.e. a PHP script that runs the test on the command line, and outputs a nicely formatted HTML result.
我开发 Web 应用程序,日常工作流程通常在 IDE 和浏览器之间切换.我希望在相同的环境中进行单元测试.
I develop web applications, and the day-to-day workflow usually switches between the IDE and the browser. I would like to have the unit testing in the same environment.
我正在寻找一些非常简单且基于 PHP 的东西 - 我打算进入 phpUnderControl(它具有我正在寻找的功能),但还没有.
I'm looking for something really simple and PHP based - I am planning to get into phpUnderControl (which has the functionality I'm looking for) but not yet.
推荐答案
您可以使用 phing 运行 PHPUnitTask 然后将输出转换为:
You can use phing to run a PHPUnitTask and then convert the output with:
- PHPUnitReport - 此任务使用将 PHPUnit xml 报告转换为 HTMLXSLT.
- PHPUnitReport - This task transforms PHPUnit xml reports to HTML using XSLT.
示例:
<phpunitreport infile="reports/testsuites.xml"
format="frames"
todir="reports/tests"
styledir="/home/phing/etc"/>
有关各种输出格式,请参阅 phpunit --help
.
See phpunit --help
for the various output formats.
PHPUnit 的 2.3 版本有一章关于这个,但现在已经有一段时间没有了.您或许可以在某处通过 Google 找到旧副本.
The 2.3 version of PHPUnit had a chapter on this, but it is gone for some time now. You might be able to find an old copy with Google somewhere.
既然你提到这是针对 phpUnderControl:如果你没有解决这个问题,请考虑使用 Jenkins 和 http://jenkins-php.org.
Since you mention this is for phpUnderControl: if you are not fixed on that, consider using Jenkins and http://jenkins-php.org.
附带说明:除非我们谈论 CI 服务器,否则我认识的大多数人不会通过 Web 界面使用 PHPUnit.他们要么只使用命令行,要么使用 IDE 集成.
On a side note: unless we are talking CI servers, most people I know don't use PHPUnit through a web interface. They either just use the command line or their IDE integration.
这篇关于“网络界面"PHPUnit 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!