# Testing with development data?

**URL:** <https://www.ruby-forum.com/t/testing-with-development-data/120906>\
**Category:** Rails\
**Created:** [November 21, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/testing-with-development-data/120906 "2007-11-21T17:35:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [November 21, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/testing-with-development-data/120906/1 "2007-11-21T17:35:34Z")

</div>

My migrations load in some default data into my database: a few  
categories, a few items, etc.

However, when I test using rake, none of that data is there. I even  
went and installed the migrate\_test\_db plug-in to build my test  
database from the migrations rather than schema, but it doesn’t work  
because all the data is wiped before each test.

It seems natural to me to run tests based on the same data that’s in  
the development database… (or even the production database,  
eventually)

I can use fixtures, but it’s really hard to create them because the  
models depend heavily on one another. For example, when I create a  
category it automatically creates a statistic and chat box to go along  
with it. It’s really hard to manually make sure that all your IDs line  
up correctly in your fixtures.

Am I doing this the wrong way? Am I not supposed to load default data  
using migrations? Do I have the wrong approach to testing?

Or is there a good way to run tests with existing data?

Thanks!
