10

I am using codeception (with codecoverage) to check the code coverage of an application I have written using the Yii2 framework. Because the standard php installation on my mac has xcode not enabled, I activated it adding a zend_module line to my php.ini. Code coverage seems to work now but is painfully slow. Yes I know that the activated xdebug and coverage generation takes some time, but I think this is not normal: Even a simple unit test which checks only the initialization of an object takes up to 15 minutes.

I don't think that it is a cpu or ram problem rather than a configuration problem.

I start code coverage with:

codeception run unit --coverage-html

Things I detected: The first test runs always fast regardless how big it is. The second test is much slower (regardless what test it is) and the third is more slowly. How can I track this down? I want to detect the problem.

Again: I know that codecoverage slows down tests, but 15 minutes for a simple test is not normal.

//EDIT: The test that runs approx. 15 minutes, takes 1 second without code-coverage enabled.

SNG
  • 358
  • 4
  • 15
palima
  • 101
  • 5
  • Same shit :( They took working phpunit code and wrap it by own... well we can call it code – whitediver May 12 '16 at 05:11
  • Hello I am getting a result Classes: (0/0) Methods: (0/0) Lines: (0/0) . I am using the same command my test cases works properly but didnt show code coverage, Whats wrong with my code – Anway Kulkarni Aug 31 '16 at 06:47
  • Are you sure it's not xdebug problem ? maybe you've set a break point or something that slows down the process. try disabling xdebug or other programs that slows down the process and try again. – TheDevWay Nov 05 '17 at 09:39
  • Is it possible to debug the process? – Gavindra Kalikapersaud Feb 17 '18 at 23:59

1 Answers1

2

You need xdebug enabled to get the coverage (which you have now done!) so disabling it will not help.

There is a huge overhead when running these sort of analysis checks, for example my Laravel app runes ~300 tests and ~1000 assertions. When getting coverage reports it takes about 5 mins to run, but with xdebug switched off and no coverage its about 15 seconds.

You maybe able to get some more performance configuring your php.ini? Maybe check how much memory you are allowing php to consume. I think default its 128mb, allowing some more may stop memory/disk grind?

If it is your application that is complicated, maybe enable profiling in xdebug, and analyse the results in PHPStorm and see what is slowing things down.

OnIIcE
  • 811
  • 9
  • 27