# \*dont\* empty the database...?

**URL:** <https://www.ruby-forum.com/t/dont-empty-the-database/57131>\
**Category:** Rails\
**Created:** [April 7, 2006, 12:37pm UTC](https://www.ruby-forum.com/t/dont-empty-the-database/57131 "2006-04-07T12:37:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![orotone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/90db22/32.png) [@orotone](https://www.ruby-forum.com/u/orotone)\
**Post date:** [April 7, 2006, 12:37pm UTC](https://www.ruby-forum.com/t/dont-empty-the-database/57131/1 "2006-04-07T12:37:19Z")

</div>

I’d like to test against a very large dataset - is there anyway to  
prevent  
the data in the test database being destroyed on each test run? storing  
the  
dataset in fixtures causes the tests to take several minutes to  
complete,  
even using csv fixtures, and that’s just for one test case!

I’d appreciate any suggestions on how to preserve the data in the test  
database  
between test runs

thanks  
al

---

<div class="post-metadata">

**Author:** ![orotone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/90db22/32.png) [@orotone](https://www.ruby-forum.com/u/orotone)\
**Post date:** [April 7, 2006, 12:37pm UTC](https://www.ruby-forum.com/t/dont-empty-the-database/57131/2 "2006-04-07T12:37:24Z")

</div>

why would you need so much test data??  
On Friday, April 07, 2006, at 10:34 AM, Alan B. wrote:

> thanks  
> al
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Mikkel B.

www.strongside.dk - Football Portal(DK)  
ting.minline.dk - Buy Old Stuff!(DK)

---

<div class="post-metadata">

**Author:** ![orotone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/90db22/32.png) [@orotone](https://www.ruby-forum.com/u/orotone)\
**Post date:** [April 7, 2006, 12:49pm UTC](https://www.ruby-forum.com/t/dont-empty-the-database/57131/3 "2006-04-07T12:49:37Z")

</div>

Alan B. wrote:

> I’d like to test against a very large dataset - is there anyway to prevent  
> the data in the test database being destroyed on each test run? storing the  
> dataset in fixtures causes the tests to take several minutes to complete,  
> even using csv fixtures, and that’s just for one test case!
> 
> I’d appreciate any suggestions on how to preserve the data in the test database  
> between test runs  
> Which DB are you using? If it’s got a nice self-contained file-based  
> store (like sqlite) you could stop the DB and swap the test data in from  
> a backup each test run. That way there’s no fixture load overhead, but  
> you’d need to customise the rake task if you want it fully automated…  
> There may well be a better way, but for the moment it escapes me.

---

<div class="post-metadata">

**Author:** ![orotone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/90db22/32.png) [@orotone](https://www.ruby-forum.com/u/orotone)\
**Post date:** [April 7, 2006, 12:55pm UTC](https://www.ruby-forum.com/t/dont-empty-the-database/57131/4 "2006-04-07T12:55:41Z")

</div>

On 07/04/06, Alex Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Alan B. wrote:
> 
> > I’d like to test against a very large dataset - is there anyway to prevent  
> > the data in the test database being destroyed on each test run? storing the  
> > dataset in fixtures causes the tests to take several minutes to complete,  
> > even using csv fixtures, and that’s just for one test case!

Does your db support transactions? check test/test\_helper.rb says

self.use\_transactional\_fixtures = true

–  
Rasputin :: Jack of All Trades - Master of Nuns  
[http://number9.hellooperator.net/](http://number9.hellooperator.net/)
