Wednesday, May 20, 2009

VSTS 2008: Database Load and Unit Test using Load Agents

There had to be a secret to this. Reading through the documentation, looking at examples, load testing with VSTS 2008 seemed a sophisticated affair, alas, only if you are working along the most popular path. More specifically only for web application testing.
I, being a renegade, wanted to use it to do Database Load testing. There are great new facilities in VSTS 2008 to create Database Unit tests but none speaks of how to do a load test.
I thought it would be easy enough to adapt the techniques in web-testing to database load testing. I found out I was very naive. I should have caught on when:
a) There was no documentation at all, no video, no web post, no nothing from MS or anyone having done this.
b) The number of errors I was getting when even trying to run it with one agent.

My test setup initially:
a) One workstation running controller and VSTS 2008
b) One server running VSTS Load Agent
c) A beefy SQL Server 2008 box to be load tested

Load testing on my workstation was working great, everthing was as expected and I was hopefull that this could easily translate into working well on the agent system. In short, it did not:

Here is the initial error I got:
  • System.IO.FileNotFoundException: Could not load file or assembly
I thought the deployment was enabled automatically, playing with the deployment option on the Test Run Configuration was not very helpfull. I ended up copying the assembly files into the same directories on the Load Agent, only to get errors referencing core related assemblies of VSTS2008. So, I created install project to deploy those... you guessed it, a wild goose chase in which I tried so many different things only to end up banging my head against a concrete wall. I nearly concluded that VSTS 2008 could not be used to do load testing for a database with Load Agents when an idea struck. This one ended up working, but could have been easily documented. So Microsoft peeps take it to heart ...

I changed the test rig in this fashion:
a) Workstation with VSTS 2008 and controller + SP1
b) Server with VSTS 2008 and Load Agent + SP1
c) SQL Server 2008

The solution, thus, is to install visual studio team system 2008 on the agent computer/server as well, then install the agent. What good is an agent that does not cover all test cases? That is something that Microsoft hopefully will resolve. There seem to be dependencies on VSTS core files, I played with it a little. You do not need:

a) Any Crystal stuff
b) SQL Server Express
c) C++
d) dotfuscator stuff
e) Documentation or redistributables

My test where in C# so I installed on support for it and no other language.

Cheers,
Bilal