http://qs1969.pair.com?node_id=324652


in reply to Testing & Databases

I think you should use a separate database; and that the database connection string should be held only in one place in your code. This will make it much simpler to connect to a different database for some useful purpouse but testing (say, having a parallel database running after a restore, or testing different versions of your app with different database schemas, and so on).

The time it'll take to insulate the connection string to a variable will be abundantly worth it.

By the way, you can very likely automate the task of finding-and-replacing, given that I guess you won't be opening a connection now and again and that the connection string - that I guess will be always the same - can be substituted to a global variable.