Closed Tray2 closed 1 year ago
I was thinking about the same issue. Maybe the better approach would be to run all migrations with seeders once and then created a dump of entire "base" database. With this approach migrate:fresh
would not be ran anymore as we would need to recreate a dump file.
That is an option, but I feel that you shouldn't run any seeders that you don't need.
If you set the seeder on your TestCase class it will automatically be seeded with the migrations (once). Just be aware that changes to this seeder will require that you manually delete or alter the checksum file
public $seeder = SomeSeeder::class
I tried that, but it didn't make any difference with seeding of around 3K records in one seeder.
I think this one can be closed without further a do
In many of my test files I run a before each function where I seed a static table. The content of this table would never change from inside the application.
So my thought is that if it somehow would be possible to add some kind of FastTableSeeder trait. that takes an array of seeder classes and keeps track of the checksum, and only runs them if needed, just like the migration:fresh.
In my case we are talking about 4 records, but for around 300 tests it becomes 1200 inserts, which takes time.
And maybe you want to be able force a run for each test file in the suite.