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.
You can get the list of tests by running the command, phpunit --list-tests
.
To get the count, run the command, phpunit --list-tests | wc -l
phpunit --list-tests | wc -l
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.