drexlz0623 2014-01-14 23:20
浏览 45

CakePHP v1.3:完整代码覆盖率报告

In CakePHP v2.x, you can generate a unit testing code coverage report from the command line using a test suite that fires all of your app's tests and the --coverage-html option. (Example: cake test app All --coverage-html=tmp/coverage/)

I've been searching for an equivalent for Cake v1.3, which uses SimpleTest. When testing via the browser, it's possible to view code coverage for each individual test case, but not for the whole App category.

Similarly, running tests from the command line via cake testsuite app all does not seem capable of taking any command-line options for generating coverage output. The v1.3 Book doesn't dive into any more detail on the subject.

So my question is: Is there a way to generate a "full" code coverage report for a Cake v1.3 application from the command line?


Additional Information for future searchers:

Per @mark-story's suggestion, I tried running cake testsuite app all cov, but that produces the following fatal error for me:

PHP Fatal error:  Class 'CodeCoverageManager' not found in
    cake/tests/lib/reporter/cake_base_reporter.php on line 131

This is with SimpleTest v1.0.1 in my app/vendors/simpletest/ folder. I tried upgrading to SimpleTest v1.1.0, but that resulted in a different fatal error:

PHP Fatal error:  Call to undefined method CakeCliReporter::SimpleReporter() in
    cake/tests/lib/reporter/cake_base_reporter.php on line 85
  • 写回答

1条回答 默认 最新

  • doudou20080720 2014-01-15 01:36
    关注

    You might want to try addin 'cov' to the end of the cli runner arguments. The help() command indicates this will work. It has been a whilre, but I think this will output the % of code covered. There is no way to generate a detailed set of coverage reports like you can with phpunit.

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法