Global Service Monitor and Visual Studio WebTests

System Center 2012 SP1 has been made generally available today (January 15th) and with it Global Service Monitor has been made publically available. I had a couple of posts in the pipeline to walk through creating the different kinds of web tests but Microsoft have done an excellent job of creating these already up on TechNet.

How to Configure Web Application Availability Monitoring in Global Service Monitor
How to Configure Visual Studio Web Test Monitoring in Global Service Monitor

But what are the options for creating Visual Studio WebTests?

Option 1: Use Visual Studio Ultimate Edition

This may seem like stating the obvious, but you can create Visual Studio Web Tests using Visual Studio, but it must be Ultimate Edition, as this is the one that comes with the ability to create webtests. Unfortunately this is the most expensive edition, but it is packed full of good things. If you would like to evaluate it then there is normally an evaluation of Visual Studio available on the Microsoft website. This will give you the ability to trial it for a period of 30 days, or 90 days if you register and get an extended key. I am using Visual Studio 2010, but the same principles will apply in Visual Studio 2012.

Once installed, you will need to create a new Test Project.

This creates a webtest project and creates some default tests. You can ignore these as we will not be using it for these purposes. In the Solution Explorer, right-click on the solution and Add a new Web Performance Test.

Once selected, this will open up a web browser with a recorder which will let you visit the website of your choice.

I am demonstrating here with a test website that I have setup for this blog article. I appreciate that it is not the most elegant of sites ever, but unfortunately this is just about the limit of my website coding skills! As you browse the site it will record all the sites and all the parameter that you use.

Once you have finished the recording, press stop to return to Visual Studio. You will need to change any recorded think time down to 0 seconds as think time is not supported by Global Service Monitoring.

Once you have your web requests in Visual Studio you can start to do many different checks and extractions. For this article I am just going to create a simple validation rule. Right mouse click on the web page and the select Add Validation Rule

I will search for the text “You have logged in successfully” in the resultant page. You do this by filling in the boxes as per below.

You can then browse to the folder containing the web test and copy it for importing into your Operations Manager environment. Once imported, you can start getting alerts if this login fails

Option 2: Fiddler2 and Notepad

The free alternative to Visual Studio Enterprise is to use Fiddler2. This is a web proxy that you can use for recording and debugging web traffic and can be found at www.fiddler2.com . It also has the ability to export the trace in Visual Studio webtest format.

Once you have downloaded and installed Fiddler, you run it and get the screen below

This will start to record all traffic on your machine so you just need to open a browser and start browsing. Once finished, click on the capturing button in the bottom left of the window.

You will notice that all my internet traffic during this time has gone through the fiddler debugger. You will need to remove the entries you do not need. Now, because Fiddler is not a test tool, it does not have the same features for creating all the rules etc so once this has done cick on File/Export Sessions/All Sessions.

This will allow you to export in Visual Studio format. Once this has been done you can then open the XML file in Notepad (or your favourite XML editor). Here you can make your changes to remove the think time and you can enter in your validation rules. Here I have simply copied the rule from the Visual Studio XML example above.

Once this is done, simply upload into Operations Manager and configure the test as before. You can even load it into the same Operations Manager test as your visual studio authored ones.

Conclusion

As you can see it is fairly easy to start recording and creating your Visual Studio Web tests, even if you do not have Visual Studio Ultimate, by using Fiddler2 and Notepad. The tricky bit will be creating the various validation rules, but you can use an evaluation edition to provide the syntax for you.

Enterprise Mobility Workshops - 24th November 2015 - London | 9:00am – 3:00pm

Leave a Reply

Your email address will not be published. Required fields are marked *