# Preload test data from factory\_girl

**URL:** <https://www.ruby-forum.com/t/preload-test-data-from-factory-girl/182872>\
**Category:** Rails\
**Created:** [February 4, 2010, 4:13am UTC](https://www.ruby-forum.com/t/preload-test-data-from-factory-girl/182872 "2010-02-04T04:13:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 4, 2010, 4:13am UTC](https://www.ruby-forum.com/t/preload-test-data-from-factory-girl/182872/1 "2010-02-04T04:13:09Z")

</div>

Is there a way to preload common data made by factory\_girl to speed up  
tests instead of recreating these common data at the beginning of  
every test. For example, I want to have 10 users premade at the  
beginning of every test.

I found this  
[http://agilewebdevelopment.com/plugins/factory\_data\_preloader](http://agilewebdevelopment.com/plugins/factory_data_preloader)  
But the page says that this plugin does not “play nice” with  
autotest. But I use autotest. Is there another solution?

Thanks.

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 4, 2010, 4:29am UTC](https://www.ruby-forum.com/t/preload-test-data-from-factory-girl/182872/2 "2010-02-04T04:29:01Z")

</div>

Learn by Doing wrote:

> Is there a way to preload common data made by factory\_girl to speed up  
> tests instead of recreating these common data at the beginning of  
> every test. For example, I want to have 10 users premade at the  
> beginning of every test.

No, you probably don’t. Factories aren’t fixtures and shouldn’t be used  
in the same way.

> I found this  
> [http://agilewebdevelopment.com/plugins/factory\_data\_preloader](http://agilewebdevelopment.com/plugins/factory_data_preloader)  
> But the page says that this plugin does not “play nice” with  
> autotest. But I use autotest. Is there another solution?

Use factories correctly. Don’t try to prematurely optimize your tests.

> Thanks.

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 4, 2010, 7:55pm UTC](https://www.ruby-forum.com/t/preload-test-data-from-factory-girl/182872/3 "2010-02-04T19:55:00Z")

</div>

Thanks Marnen. I’ll heed your advice.
