-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database Seeders vs. Factories #48
Comments
Hi! Here are a few things factories provide:
Seeders:
BTW, both the seeder class and the tripal test case class provide a “$this->publish($chado_table_name, $record_id)” method to convert chado records into entities in case you wanted to run tests on entities |
Oh, I think I see! :-) Thanks! Just to check my understanding:
|
Precisely! |
@almasaeed2010 do seeders do inserts only or updates? I'm thinking about seeders running multiple times and getting db errors because of it. @laceysanderson i think if you are using seeders in the context of testing, then you'll want to a) run the seeders in the Travis container before running your tests and b) document that you need to run them for tests to pass for contributors. Factories on the other hand are meant to be lightweight, run once per test. |
Seeders don't run automatically. You have to use |
oh thats neat, so running within test, with transactions, is do-able. So in that case its for "complex operations" as you say. Cool. |
What is the difference between Database Seeders and Factories? All I could gleam from the README is that both are re-usable ways to add data for tests and that factories can be used in database seeders.
Which raises my next question, when should I use factories vs. database seeders?
PS. For context, I'm adding some simple tests to Tripal BLAST :-D
The text was updated successfully, but these errors were encountered: