Ordered Load Tests in VS 2008 SP1

| | Comments (0) | TrackBacks (0)

This week my colleague and I were trying to run a dozen load tests in sequence. What we wanted was to execute a list of tests, so that we could go home and come back the next day to the results. Unfortunately, this is not possible with Visual Studio 2008 SP1. Apparently, there is a bug (that doesn't seem to have been fixed in the first service pack) that prevents one from selecting multiple load tests in the test view and executing them all. Dennis Stone suggested in a Microsoft forum post to work around this bug by queuing up the execution of the load tests one by one. The problem with this proposal, however, is that it will only work if you are using a remote test controller; the local controller only supports the execution of one load test at a time, so a second can't be queued after the first has started.

The work around that we found to execute the load tests one after the other was to use a batch file. Once we learned how to run a load test from the command line, it was short work to put together a script that would slave away for us all night. One gotya that nabbed us was the omission of the test run configuration information. Without this, our auxiliary files weren't copied to the proper directory and some of our tests failed, thus causing our task to take two nights instead of one :-(

So, to create an ordered load test, use MSTest in a batch script like this:

mstest.exe /runconfig:localtestrun.testrunconfig /testcontainer:LoadTest1.loadtest
mstest.exe /runconfig:localtestrun.testrunconfig /testcontainer:LoadTest2.loadtest
mstest.exe /runconfig:localtestrun.testrunconfig /testcontainer:LoadTestN.loadtest

After MSTest completes, the test results will be stored in the load test database, and you will be able to analyze them as usual using Visual Studio or SSRS.