Need help to find reason for slow PHPUnit startup
Hello all!
System details first:
- Windows 8.1
- PHPStorm EAP 136.1768
- PHP 5.5.9-VC11-x64
- phpunit.phar 4.0.17
In a larger project, I've created a rather simple UnitTest for a single class with 11 assertions without any dependencies. Running the test inside PHPStorm yields the following output:
C:\Users\Willy\Apps\PHP\5.5.9-VC11-x64\php.exe -c C:\Users\Willy\Apps\PHP\5.5.9-VC11-x64 C:\Users\Willy\AppData\Local\Temp\ide-phpunit.php --no-configuration C:\Users\Public\Web\frontend
Testing started at 11:47 ...
PHPUnit 4.0.17 by Sebastian Bergmann.
Time: 20.55 seconds, Memory: 7.00Mb
OK (11 tests, 11 assertions)
Process finished with exit code 0
Actually 19.5 seconds of the time I'm watching a spinner saying "Instantiating tests...". It is very tedious to run tests this way, so I would be thankful for any hint what settings to adjust so PHPUnit will run smoothly.
Running the same test in a command line window without the PHPStorm boilerplate yields the following output:
C:\Users\Public\Web>C:\Users\Willy\Apps\PHP\5.5.9-VC11-x64\php.exe phpunit.phar frontend\tests\L10NTest.php
PHPUnit 4.0.17 by Sebastian Bergmann.
...........
Time: 107 ms, Memory: 6.50Mb
OK (11 tests, 11 assertions)
Best regards,
willydee
Please sign in to leave a comment.
Please provide CPU snapshot:
https://intellij-support.jetbrains.com/entries/29983118-Reporting-performance-problems .Hello Liubov, here we go.
Uploaded via FTP: PS-136.1768_Willy_05.05.2014_21.51.41.zip
Best regards,
willydee
There is nothing in your CPU snapshot that indicates strnage slowness,
Can you please provide sample code to reproduce and idea.log (Help | Show log)?
Hello Liubov,
Even simplified code, without any dependencies or includes, when being executed in my working repository, leads to a 20 seconds delay with the results panel showing "Initializing tests...". If I copy the class and test file to an empty project folder and execute the unit test there, it finishes in about 40 ms. So the problem is not directly related to the code being tested, but apparently to the project contents. I cannot send the whole project repository, because the code is under non-disclosure.
The log folder contents: uploaded via FTP, see PS-138.256-logs_Willy_28.05.2014_23.51.12.zip
Best regards,
Willy
Message was edited by: Wilfried Schott
Code sample was totally messed up, deleted it . Uploaded via FTP instead, for completeness: SimplifiedTestCode_Willy_29.05.2014_00.15.12.zip
Hello Liubov,
I was able to find the problem by myself. When creating the Run/Debug Configuration, I did not set the correct test scope. It was set by default to the project root, even though so far only two unit tests exist in a subfolder. So I suppose PHPUnit was scanning the whole project for PHPUnit_Framework_TestCase subclasses (or something like that). Setting the test scope to the subdirectory containing the unit tests, or just choosing a single unit test, works without any problem.
Best regards,
Willy