Redirect SimpleTest queries to a different database How can I tell SimpleTest to use a different database than the default connection? I want to be able to run the tests against an in memory database while keeping the local data on disk.

UPDATE:

So far the answers I'm getting are on how to set up tmpfs and move mysql data to that folder. That's great and super helpful. However this is missing the specific answer that I am looking for. I'm most interested in how to run SimpleTest against a different connection than the default database connection. You can see above that my question reflected by both the title and the first line of my original submission. I apologize for the confusion caused by my mention of an in memory database, I provided that only as context, but it is not the root of my question.
It's not possible to do this on a storage engine level. You can't install Drupal on top of the HEAP storage engine, there are various missing features, the most obvious one being: "MEMORY tables cannot contain BLOB or TEXT columns." (copied from the link in the comments).

The qa.drupal.org testbot's have the complete MySQL data directory in a tempfs that is stored in memory, which is copied from the real file system during startup and back during shutdown. I don't think that's a doable setup for a development environment because, at least in my case, databases of real sites quickly get too big for something like this (Working on large sites with multiple GB of data). http://drupal.org/node/466972 has some more tipps and scripts for the tempfs thing. Make sure to read the comments.

Not sure what exactly takes 2,5m in your case, I can run a single test in ~10s (Note that every test method is a separate test that runs in a new installation).

I'm quite sure that I've already written quite a list of tipps on how to speed up tests in an answer somewhere but I'm unable to find it. The most important thing is defining $profile = 'testing'; in your test class, that will only install the absolutely required modules for Drupal to run. Speeds up test runs by ~50%. Another way is prefixing your different test methods with anything other than test and having a single public test method that calls all other. Downside is that your tests then run in the same environment and might affect each other. You e.g. can't have hardcoded node id's and things like that.

Another thing is optimizing your mysql configuration, than can speed up tests quite a bit as well, see http://techblog.md-systems.ch/blog/improve-mysql-performance for a start.

To actually override the used database connection, you need to completely overwrite the setUp() method where the connection is created and activated and instead use whatever connection you want, see DrupalWebTestCase::setUp().