Tuesday, July 21, 2009

Using Setup Scripts in For Visual Studio Unit Tests

I could not find much documentation on this so I thought I should post a quick overview of how to create setup scripts for Visual Studio. You specify the setup script in the testrunconfig file under "Setup and Cleanup Scripts" the script is relative to the solution file it applies to. When you run a unit test you will see a qtsetup.bat in the
folder. Open the file and it will show you your script merged with the variables generated by the testing process very useful if you are looking for the Deployment Directory Path. The Setup Script is executed relative to the deployment dir folder or
in most cases.

One drawback to using deployment items is you cannot use wild cards in the includes. In my case this was a pretty big problem because my binaries are all in one folder, upwards of 500 files. As a work around I created a cmd file and executed a file copy instead this saved a huge amount of time when executing a unit test.

No comments:

Post a Comment