Database setup

Apr 1, 2010 at 8:26 PM

It is easy to see where to plug in the data needed for a given test. But where/how do you recommend scripting out the most recent schema (table structure, stored procedures, and other user objects) before starting as set of tests?

My best guess was to do this before calling TST with another PowerShell script. Or do you have a place for this that I missed?



Apr 2, 2010 at 9:57 PM

You are right, the setup operation belongs to a process/script that is outside of the T.S.T. features or even T.S.T. recommendations.  

T.S.T. does not really care or know anything about how the DB is setup (including how the test stored procedures are setup). If it did it would only get in the way of the setup processes people usually already have.

The typical steps are:

  1. Have some setup scripts (can be CMD or PowerShell or pretty much anything else you want) that will build the database schema for the product. I assume you already have that in a form or another.
  2. Reuse the scripts from step 1 to setup the test stored procedures. One thing to note here is that you probably want some separation between the actual product DB objects and the test procedures. You can place all the test procedures in a separate schema if you wish. Or you can even place them in a separate database. That would give you good isolation between the actual product and the test stuff.
  3. Have a trivial script that will actually trigger the test. 

If you have a build process or some continuous integration process you’ll probably integrate in them the DB setup and the test execution.