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

Load1

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

load2

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

load3

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.

load4

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

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.

Advertisements

Visual Studio Productivity Power Tools for VS 2012

Well for starters let me assume you are a poor dev like me and don’t have access to Resharper! Well in case you do they have a lot of these features that are now available free of cost in Productivity Tools in VisualStudioGallery.msdn.microsoft.com.

Let me quickly show you some of the features that stand out pretty instantaneously .

1.PresentOn/Off – type this into the quick launch and lo you get the power of zoomit 🙂

PresentOn

2.You can now edit a project file by right clicking on the project.

Edit Project

3.Browse to definition by pressing on control and left mouse click.

Definition

4.Email code snippets by using the same option in context menu.

Email

5.Now you can find duplicate code snippets by selecting the option “Find Matching clones in solution” in context menu.

Clones

Also there are other features like Auto Brace Completion,Open Command Prompt and HTML copy.
So go ahead and give it a download!!

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 🙂

unittest

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!

DotNet Decompiler dotPeek

Ever since Reflector became paid from free, dotNet developers have been searching for a good alternative.They even said till version 6.0 the Reflector would still work,but for some reason it never used to for me,even if i would never upgrade my reflector.Anyways i found a good one called dotPeek from the JetBrains(yeah the same guys who have that wonder tool called ReSharper).You can download from here.And you can decompile from .NET versions 1 to 4.5 . Good luck reengineering !

How to a run the ASP worker process under another user credential

Well i discovered this when i had to debug a service on a server on which i no permissions.Since it was a WCF call and was hosted on the IIS,i figured i needed a cheat.So this is what i did.Before i start with the details let me tell you the environments that i have been using.VS-Studio –2008 dotnet stack on Windows XP(sp3).And i was using IIS 5.1 on my machine which is an XP.So here goes.

First change the username and password in the machine.config under the processModel tag as shown below.

Code Snippet
  1. <system.web>
  2.     <processModel autoConfig="true" userName="username" password="******"/>
  3.     <httpHandlers/>

And i tried adding permission to the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder too.

That resulted in an error which gave an “Failed to access IIS metabase” error .So finally i figured MetaAcl tool needs to be downloaded from the following location

http://download.microsoft.com/download/5/7/3/57316f36-ded6-41f0-b694-8b0102ade818/metaacl.exe

This has a metaacl.vbs script which adds permission to the users.You need to add the file to the following folder c:\Inetpub\Adminscripts and then go this folder from the command prompt.Then run the command

c:\Inetpub\Adminscripts>cscript metaacl.vbs IIS://LOCALHOST/W3SVC
                                     mydomain\mydomainaccount RW

 

For more info go to the following KB article in MSDN.(http://support.microsoft.com/kb/326902)

Custom Configuration Designer!

There has many a time that i have posted on tools, that makes life so much simpler,in order that we can can have the extra time to fall in love with C#!So many of us hate to see Xml. Lets admit it ,not many are in awe of the beauty called xml and have burnt their fingers and are not comfortable with it.But next time when you hear that you have to create a custom configuration,don’t fear as we have tools in place to handle that.Thanks to the wonderful tool called Configuration Section Designer.I wouldn’t have ventured into it had not i made a silly mistake which took my entire day and i began to question the logic of creating all these with mere hands and why not get it automated?

You can install the Configuration Section Designer from here.Once you download the plug-in and install it ,it fits perfectly well with VS-2008. and VS-2010 folks ,your version is yet to be out.But once you have installed the Custom Configuration Designer you can see that you will get a project like the snapshot available for you to play around!

 

 

Once you have created the Custom Configuration ,you will get a default custom Section designer diagram which will be empty .Go to the properties and enter the values in Namespace and XmlSchemaNamespace as follows.

 

 

Once you are done naming your namespace as well as the xml schema namespace, you can go ahead and drag and drop the Config Section, Config Section Group, Configuration Collection  as well as Configuration Element.Here is sample that I have created.Its really simple isn’t it?

 

 

And you can add custom classes to the existing predefined system types for your elements as well as the attributes as well as mention if it required and to make a certain attribute Key for a Config Collection.And then all you need to do is build it .

 

Max Length of Command Line Arguments

What started out as an experiment,caught me by surprise in VS.The max length that i can pass to as a Command Line Arg is 4096 characters(4K).ie if i enter 11111…. 4196 times.After that Ting!

image

As i did my experiment in Win-7 this was the limit.More search on this topic led me to this Kb article.http://support.microsoft.com/kb/830473.

Summary:

1) If you run this application through command prompt:

If you are running Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. If you are running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.

Please refer to this page for more information: http://support.microsoft.com/kb/830473/en-us

2) If you run this application by CreateProcess():

See the description of lpCommandLine parameter:

[in, out] The command line to be executed. The maximum length of this string is 32K characters. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

Please refer to this page for more information: http://msdn2.microsoft.com/en-us/library/ms682425.aspx