Most of the guidance you’ll find about Visual Studio Ultimate Load Tests suggests that they are only for load testing Web Performance tests. Actually, they can be used to load other types of tests, such as unit tests. I demonstrated this at STARWEST last week. Instead of load testing the execution of a database or other service, I thought I would try something fun. I created a simple unit test that played a random tone using the beep command and then placed that under load.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Cool.Tests
{
[TestClass]
public class Load
{
[TestMethod]
public void BeepTest()
{
int frequency = new Random().Next(1000, 5000);
Console.Beep(frequency, 50);
}
}
}
I then created a simple load test called Symphony.loadtest and added the BeepTest to it.
The resulting load test was fun to listen to. Click the image below to see for yourself.
Attachment: LoadTestProject.zip