Saturday, 1 May 2004

Faster, better, stronger testing

One of the things that I have been working on for the first time has been testing my application that connects to a database. I know, it's silly that this is the first time this has happened, but that's the way things are.

First, when we run the test suite, we want it nice and clean, so we tear down and rebuild the structure. This means that every time we run the tests, we should get the same results. We had to make sure that we were not stepping on each other's feet, so we are just using different schemas. This is configured in the web server setup, so it's not in the application code itself. So far, so good.

One problem has been when the server that does hosts the oracle db had to shutdown. That stopped testing -> development. A problem that just occurred to me is also if you share tables across schemas. That would be a problem too. And the third problem: we don't actually need persistence writing to the disk. We just need something to simulate it. And I think that the additional I/O just slows down testing too, but that could just be a case of thinking that I know where the bottle neck is, but I don't for sure.

I've asked Andrew about this before and he wrote about using a in memory database as another option. This was part of "the doing the simplest thing first" part of XP. Something that I didn't really figure out before. Ah well. Well, we just jumped right into having a database, so no in memory persistence mech. was made.

What I would like to do is have a "in memory" database. Something that I could
  • run the queries against
  • something that I wouldn't have to worry about connecting to a "real" database without installing one on each workstation
  • where the developers would not be stepping on each other's toes
  • where it would be as fast as possible
HSQL looks like it would almost be perfect for this since it seems to have a "in memory" mode. I would think that this means that it will behave the same in both cases, and I wouldn't have to worry about maintaining 2 different persistence types. I know that I don't have time to play around with that now, but I'll see if I can do that in the future.
Listening to: John Williams - Star Wars Soundtrack - Imperial March


No comments:

Post a Comment