Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load fixtures correctly for a test suite using Test::DBIx::Class?

I have a bunch of tests for my DBIx::Class schema and I am using Test::DBIx::Class. This is great as it gives me useful test functions and loads fixtures. It also has a Test::mysqld trait so I can dynamically create a test mysqld instance, deploy the schema, load fixtures and test. But if I have a bunch of test scripts it seems silly to start the server, deploy and load fixtures at the start of each script when instantiating via the constructor.

What is the best way to create the test database and populate it for the duration of my tests?

like image 596
cubabit Avatar asked Nov 05 '22 04:11

cubabit


1 Answers

At work one of the first tests we run loads all the fixtures the rest of the tests require. That's one way of managing it but your later comment also sounds sensible.

like image 157
Adam Taylor Avatar answered Nov 09 '22 09:11

Adam Taylor