I have added many tests in my Symfony2 project, but now with 53 tests and 176 assertions it takes about a minute. I'm trying to reduce this time because if I enable code coverage report it takes 15 minutes.
$ phpunit -c app/phpunit.xml.dist PHPUnit 4.3.5 by Sebastian Bergmann.
Configuration read from app/phpunit.xml.dist
.....................................................
Time: 59.1 seconds, Memory: 361.00Mb
OK (53 tests, 176 assertions)
I've configured LiipFunctionalTestBundle correctly to use a SQLite database in the test
environment (this is recommended by LiipFunctionalTestBundle):
app/config/config_test.yml
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
path: %kernel.cache_dir%/test.db
And I've added fixtures with DoctrineFixturesBundle.
Now I have to create tests suites or groups to launch several instances of PHPUnit. But I'm seeing a future problem: how can tests can be parallelized (for example with paratest) if two or more instances of phpunit write and read data in the same SQLite file?
I can Pass a variable to PhpUnit to change the kernel.cache_dir
value and create one cache
directory per phpunit instance. But it can't be done from the command line, so if I choose this solution I'll have to create several phpunit.xml.dist
. I'm looking for a more convenient solution.