Load Testing

I guarantee you this blog is going to be short and sweet but yeah it will add 2cents to your Info DB! So lets start ,how do you do load testing? Have used the load tests in Visual Studio? Its pretty much a breeze if you are familiar with the IDE.You can do a web performace test or a load test in Unit tests


And you can even step up the number of users(read traffic) or have a constant load.


You can do web testing in the same manner as you normal methods in C#.


In addition you can also try other tools like Fiddler.Simply pass the url that you wish to test in Composer section and repeat the call selecting the session and hitting Shift + R.You will get the results under statistics.Thats as simple as it can get.


There is another amazing tool called stressstimulus which hooks with the fiddler and provides some cool features.

You can see a quick demo here (http://forums.asp.net/t/1666267.aspx?Free+Load+Testing+Tool+Fiddler+add+on+StresStimulus)
Lastly there are now lots of free sites (http://loaduiweb.org/), where you can test your rest urls and load test them.But now sure if you are ready to test is on another box in case you are working for some corporate organisation.

Setup Load Testing in Visual Studio

Well most often MS doesn’t setup stuff .So you have to do it for yourself.Like for Load testing in VS test cases,
you have to configure the database “LoadTest2010” and the corresponding tables like LoadTestRun,LoadTestCase,…
Well this is how you can do it in case you stuck at it.

Browse to this folder and execute in command line else you can always run the script in Management Studio.

cd “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE”

SQLCMD /S localhost\sqlserver -i loadtestresultsrepository.sql

Copying Directory or File in VSTS test cases

Well this one was pretty nasty I must admit.I didn’t know that I would lose some time on this one.And since I did I might as well blog about it.So here goes the problem statement.Have you faced the scenario wherein you had to copy some files under some folder in Unit tests in Visual Studio? This is because the test cases run under a folder called test results and each time you run it creates a new folder for that particular test case. Mind you before I start I must say that I have encountered this on the VS-2010 and not on the nascent versions of Visual Studio viz 2012.So here goes as to what you need to do to achieve the same.

1)First go the TestSettings file in VS 2010 which is directly under solution.
2)Go to Deployment section and check Enable deployment and add the directory that you want to add.


3)Now is the trick part you have to edit the Test Settings file in Xml editor and go the tag under Deployment which has the required DeploymentItem and the attribute outputDirectory as follows.


4)Finally the worst part was now when you run the unit tests you will still now find it added.So to get it in working in VS 2010 you have to select the test list editor under the Test–>Windows menu in Visual Studio IDE.And then select your tests and hit run.Eureka… ooo still not there yet.The directory or file is still not out there!

5)Close your Visual Studio IDE and open it once again.(Age old trick works in the realm of WINDOWS).

So happy testing once again πŸ™‚

Run Unit Tests in Visual Studio after locally building your Solution !

Ever felt the need to run unit tests as a part of building your solution locally?Yeah,that sounds like you can do fix/break solution immediately πŸ™‚ Ok,s before we jump to conclusions and go overboard, let us see how we can do this in VS2010.Like you would have already guessed there is an extension called “Continuous Testing for Visual Studio 2010“. Download it from here.Since its free and from Visual Studio Gallery ,I was tempted to install it.So just build it and saw that all my tests were failing as usual! Also in case you are pissed off that your test cases failed and dont want this feature you can always disable it from the Extension Manager from Tools Menu in Visual Studio.Here is the output post building locally,not great though πŸ™‚


BTW i had read posts that you can execute MSTest.exe from build events using commands,but i was facing some issue with it .So do let me know if you work with that as well.Anyways Continous Testing works great.So let me build and break with more abandon!