Speed up Tests with SQLite3 in Memory
March 3rd, 2007
Did you know you can use a memory-based database to run your Rails tests? Compared to running tests against a regular database (PostgreSQL, MySQL, or SQLite), it’s much, much faster.
You’ll need SQLite (http://www.sqlite.org/, http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite) and the MemoryTestFix plugin (http://topfunky.net/svn/plugins/memory_test_fix/) from Geoffrey Grosenbach.
The instructions given are great, except if you use SQLite3, like me. If you do, you’ll need to make a small tweak to the memory_test_fix.rb
file. On line 4, Simply change SQLiteAdapter
to SQLite3Adapter
. That’s it! Enjoy faster tests!
Linkage
- http://nubyonrails.topfunky.com/articles/2006/06/01/san-francisco-sqlite3-memory-tests-asteroids
- http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
- http://topfunky.net/svn/plugins/memory_test_fix/
- http://www.sqlite.org/
- http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite
Sorry, comments are closed for this article.