# Seeding database data for tests

**URL:** <https://forum.elixirforum.com/t/seeding-database-data-for-tests/14855>\
**Category:** Questions\
**Tags:** ecto, testing, seed\
**Created:** [June 25, 2018, 5:45pm UTC](https://forum.elixirforum.com/t/seeding-database-data-for-tests/14855 "2018-06-25T17:45:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [June 25, 2018, 5:50pm UTC](https://forum.elixirforum.com/t/seeding-database-data-for-tests/14855/2 "2018-06-25T17:50:50Z")

</div>

`mix test` won’t seed your database, because nothing will cleanup the data which was inserted outside of the sandbox transactions of single tests. Also having those countries seeded would mean they are the same to all tests, which imho can be as annoying as any other global state in your system. I’d rather opt for inserting those countries via a Factory on demand, so you can control on a per test basis which countries are in the database.

---

_[View the full topic](https://forum.elixirforum.com/t/seeding-database-data-for-tests/14855)._
