phpunit:如何获取测试目录中的测试计数,而不运行测试 [英] phpunit : how to get the count of tests in a test directory without running test

查看:214
本文介绍了phpunit:如何获取测试目录中的测试计数,而不运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想静态地得到一个目录中的测试数量。有什么可用的,我可以使用吗? Phpunit似乎在测试运行前有一个计数说0/100,并在测试完成时递增。我想手动提取这个数字,并退出运行可能。

解决方案

https://github.com/sebastianbergmann/phploc =nofollow> phploc 可以给你,就像 grep / wc -l <​​/ code>如上所示,估计的测试次数。例如,由于数据提供者,没有实际执行测试,就不能有确切的数字。


I would like to statically get a count of number of tests in a directory. Is there something available that I can use? Phpunit seems to have a count before test runs say 0/100 and increments it as the test completes. I would like to fetch that number before hand and exit the run possibly.

解决方案

The --count-tests option of phploc can give you, just like the grep / wc -l line shown above, an estimate of the number of tests. Due to data providers, for instance, there cannot be an exact number without actually executing the tests.

这篇关于phpunit:如何获取测试目录中的测试计数,而不运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆