Framework: DatabaseMigrations is too slow for each test, how to fix ?

Created on 29 Jun 2017  路  4Comments  路  Source: laravel/framework

  • Laravel Version: 5.4
  • PHP Version: 7.0
  • Database Driver & Version: MySQL 5.7

Description:

When I run phpunit testing it takes long time to complete process because of migrations and seed, so how to fix this problem ?

Most helpful comment

Instead of using DatabaseMigrations, migrate and seed your database before testing and use the DatabaseTransactions trait. This should speed it up a bit.

All 4 comments

Instead of using DatabaseMigrations, migrate and seed your database before testing and use the DatabaseTransactions trait. This should speed it up a bit.

@RikSomers the migrations and seed commands are too slow

Is your mysql database local or on a separate machine? Any reason you're using mysql for testing instead of sqlite in memory? Do you need database migrations on every test? Are you using them selectively? Are you doing more than just schema changes in your migrations ( like data updates / api calls to hydrate data / etc )?

Any additional information would be useful. Just saying it's slow doesn't really give us much to work with. Way too many variables.

Please ask on the forums, this repo is for bug reporting only.

Was this page helpful?
0 / 5 - 0 ratings