<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Michael Taute's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/mtaute/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/mtaute/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:25:44 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Tracking viewstate using a webtest playback add-in</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/tracking-viewstate-using-a-webtest-playback-add-in</link>
      <pubDate>Wed, 10 Mar 2010 15:25:08 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2010/03/10/tracking-viewstate-using-a-webtest-playback-add-in/</guid>
      <description><![CDATA[&#160;  One of the coolest features I think we’ve added in Visual Studio 2010 is the ability to add...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>One of the coolest features I think we’ve added in Visual Studio 2010 is the ability to add your own tabs into the webtest playback view.&#160; Extending the user interface in this way allows you to do data analysis and have it pop up right in front of you in whatever format you want.&#160; No more exporting to excel or whatever your favorite analysis tool is, just compile everything you one in one place and voila!</p>  <p>That being said, I have been told that it can be difficult to grok at first glance.&#160; So, I wanted to post a sort of ‘how to’ in order to get one of these working.&#160; A colleague of mine suggested that I could use this forum to demonstrate how to keep track of something that affects the performance of many users’ websites.&#160; Namely, Viewstate.&#160;&#160; So, below is a step by step instruction on how to create a webtest playback tab which keeps track of the viewstate size for each request.</p>  <p>&#160;</p>  <p><strong>Step 1:&#160; Create the add-in project</strong></p>  <p>Visual Studio Add-ins have their own special type of project, you can find it under “Other project types / Extensibility”.&#160;&#160; I’ve named mine “ViewstateAddin”.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectCreation.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectCreation.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ProjectCreation" border="0" alt="ProjectCreation" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectCreation_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectCreation_thumb.jpg" width="662" height="457" /></a> </p>  <p>&#160;</p>  <p><strong>Step 2:&#160; Walk through the create add-in wizard</strong></p>  <p>When the wizard launches, you’ll be add a “welcome” screen.&#160; Click next to move to page 1.</p>  <p>Page 1 asks you which language you’d like to program your add-in with.&#160; I chose C#, but VB or C++ are supported as well if you prefer.</p>  <p>Page 2 will ask you where your add-in needs to be hosted.&#160; Since webtest playback is not available within VS 2010 Macros, you can uncheck that box and simply leave the main VS 2010 product selected.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectHosts.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectHosts.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ProjectHosts" border="0" alt="ProjectHosts" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectHosts_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ProjectHosts_thumb.jpg" width="508" height="386" /></a> </p>  <p>Page 3 asks you for the name and description of your add-in.&#160; These will be visible to your users in the manage add-ins dialog, so don’t skimp here.&#160; I’ve added mine as shown.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/nameanddesc.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/nameanddesc.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="nameanddesc" border="0" alt="nameanddesc" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/nameanddesc_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/nameanddesc_thumb.jpg" width="507" height="390" /></a> </p>  <p>Pages 4 and 5 will ask you for a general idea of what your add-in will do.&#160; For example – when you want the add-in to load into memory and whether you will be popping any modal UI from your code.&#160; I suggest leaving all of the boxes unchecked (on both pages) if this is your first time creating an add-in.</p>  <p>Page 6 is just a summary page of everything you’ve selected thus far.&#160; If everything looks as you expect, click finish to create your bare bones add-in.</p>  <p>&#160;</p>  <p><strong>Step 3:&#160; Creating the user control and adding required references</strong></p>  <p>The user interface you design will be housed within a single user control.&#160; Inside that control you can do as you please, but first you must create the user control container.&#160; This is accomplished under the project menu by selecting “Add User Control”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/AddUserControl_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/AddUserControl_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="AddUserControl" border="0" alt="AddUserControl" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/AddUserControl_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/AddUserControl_thumb.jpg" width="503" height="409" /></a> </p>  <p>&#160;</p>  <p>You can name the user control anything you want.&#160; I’ve named mine “ViewstateControl.cs”.&#160; This will add a blank user control to the project which will be used extensively in the next few steps.&#160; For now, you can leave it blank.</p>  <p>&#160;</p>  <p>Before moving on, you will also want to add 2 references to your project:</p>  <p>First - Microsoft.VisualStudio.QualityTools.WebTestFramework.dll (This one can be found on the .NET tab of the add reference dialog.)</p>  <p>Second – Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll (This one you will need to use the browse tab in the add reference dialog and look in %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies)</p>  <p><u><font color="#ff0000">Caution:&#160; Make sure you’re using Version 10.0 of these assemblies or your add-in will not work.</font></u></p>  <p>&#160;</p>  <p><strong>Step 4:&#160; Adding the connection code</strong></p>  <p>The process of getting a playback add-in to work for you is a two step one.&#160; First, you need to tell the playback window that your control exists.&#160; Then you need to register for event notifications.&#160; First, let’s go over telling the playback window that you want to have your user control displayed.</p>  <p>This is done from within the Connect class.&#160; If it’s not already open, open the Connect.cs file from solution explorer.&#160; Inside the Connect class, you will need 2 things.&#160; First, an object containing a list of your user controls. (One add-in can provide support for any number of user controls.&#160; Each user control will get its own tab.)&#160; Second, you will need a handle to the LoadTestPackage Extensibility object. (Don’t worry, it’s harder to say than it is to use.)</p>  <p>Each of these objects needs to be global to the Connect class and declared as follows:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ObjectDeclaration_1.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ObjectDeclaration_1.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ObjectDeclaration" border="0" alt="ObjectDeclaration" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ObjectDeclaration_thumb_1.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ObjectDeclaration_thumb_1.jpg" width="953" height="198" /></a> </p>  <p>&#160;</p>  <p>The next method is one you’ll need to add to the Connect class.&#160; It will be called when your add-in is loaded for the first time to attach to any existing playback windows as well as each time a new playback window is created.&#160; It is responsible for making sure the playback window is displaying a tab with your control on it.&#160; If you’re having trouble getting a tab to display, this is one of two likely places to look for a problem. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowCreated.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowCreated.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WindowCreated" border="0" alt="WindowCreated" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowCreated_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowCreated_thumb.jpg" width="778" height="301" /></a> </p>  <p>If you’re having trouble getting all of the above objects to resolve, make sure you have the following using statements in the file:</p>  <ul>   <li>- Microsoft.VisualStudio.TestTools.LoadTesting</li>    <li>- System.Collections.Generic</li>    <li>- System.Windows.Forms</li> </ul>  <p>As you can see above, there is no constructor for ViewStateControl that takes a WebTestResultDetails argument.&#160; Don’t worry about that just yet.&#160; It’s expected since we haven’t written any code for the control.</p>  <p>Now that you’ve created the method which will be called when your control needs to load, you need to make sure it gets called.&#160; There are 2 times when your control will need to load.</p>  <ul>   <li>- When your add-in is loaded and there are existing webtest playback windows open.</li>    <li>- When a new webtest playback window opens.</li> </ul>  <p>For the first case, we just need to call the WindowCreated method from the OnConnection method.&#160; You do this by first creating a handle to the Loadtest package extensibility object and then calling WindowCreated for each open window.&#160; For the second case, you need to subscribe to the WindowCreated event from the extensibility object and call WindowCreated from within the event handler.&#160; </p>  <p>Your OnConnection method and event handler should now look like this:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/onconnect2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/onconnect2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="onconnect2" border="0" alt="onconnect2" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/onconnect2_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/onconnect2_thumb.jpg" width="789" height="442" /></a> </p>  <p>&#160;</p>  <p>That’s all that is required to get your new tab to display within webtest playback.&#160; If you were to fix up the call to the nonexistent constructor above, you could compile and give it a shot.&#160; Sadly though, you’d see nothing but a blank tab.&#160; So let’s keep going and finish the add-in.</p>  <p>&#160;</p>  <p><strong>Step 5:&#160; Registering for events</strong></p>  <p>Now that the add-in will display, you can get to the meat of the add-in, registering for and handling events.&#160; The following events are available for your add-in to hook.</p>  <ul>   <li>WindowCreated&#160;&#160; [Called when a new playback window is created]</li>    <li>WindowClosed&#160;&#160;&#160;&#160; [Called when a playback window is closed]</li>    <li>SelectionChanged&#160;&#160; [Called when a new request is selected in the playback window]</li>    <li>TestCompleted&#160;&#160;&#160; [Called when the webtest has completed] </li> </ul>  <p>You have already seen how to subscribe to the WindowCreated event in Step 4 above.&#160; The other events are subscribed to similarly and in the same place.&#160; In fact, for this demo you will need to subscribe to each of them.&#160; Here’s what the OnConnection method should look like after you’ve subscribed to the events.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/latestonconnect.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/latestonconnect.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="latestonconnect" border="0" alt="latestonconnect" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/latestonconnect_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/latestonconnect_thumb.jpg" width="1061" height="325" /></a> </p>  <p>For now, you’ll need to create stubs of each of these event handlers so that the code will compile.&#160; We’ll get back to writing these handlers in step 7.</p>  <p>&#160;</p>  <p>Step 6:&#160; Writing the UI</p>  <p>Now that you’ve created the add-in, it’s time to add the meat of what you want to see.&#160; I am by no means a UI expert, but I’ll give you enough to get started here.&#160; I dropped a listview and a label onto my user control.&#160; The listview I gave 3 columns – row number, viewstate size, and the URL.&#160;&#160; The label will contain the viewstate size of the currently selected request in the UI.&#160; It looks like this:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/controlUI.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/controlUI.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="controlUI" border="0" alt="controlUI" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/controlUI_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/controlUI_thumb.jpg" width="512" height="336" /></a> </p>  <p>&#160;</p>  <p>For the code behind the UI, I created 3 main methods.&#160; The first is a utility method to pull out the viewstate from the response body of a request.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/GetFormFieldValue_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/GetFormFieldValue_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="GetFormFieldValue" border="0" alt="GetFormFieldValue" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/GetFormFieldValue_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/GetFormFieldValue_thumb.jpg" width="833" height="384" /></a> </p>  <p>Next, a method to iterate through the list of requests and update the listview…</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/summarydetails_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/summarydetails_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="summarydetails" border="0" alt="summarydetails" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/summarydetails_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/summarydetails_thumb.jpg" width="840" height="276" /></a> </p>  <p>And finally, a method which will update the label with the viewstate size of the currently selected request.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/requestdetails_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/requestdetails_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="requestdetails" border="0" alt="requestdetails" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/requestdetails_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/requestdetails_thumb.jpg" width="838" height="84" /></a> </p>  <p><strong>Step 7:&#160; Putting it all together</strong></p>  <p>At this point, all of the code is written except the event handlers.&#160; We just need to add calls from the event handlers to the UI update handlers and clean up memory.</p>  <p>The TestCompleted event is a good event to use when getting summary data.&#160; I’ve used it to call the UpdateSummaryDetails method as shown below.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/TestCompleted_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/TestCompleted_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="TestCompleted" border="0" alt="TestCompleted" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/TestCompleted_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/TestCompleted_thumb.jpg" width="873" height="185" /></a> </p>  <p>&#160;</p>  <p>For changing data when different requests are selected in playback, you’ll want to use the SelectionChanged event.&#160; I have used this event to call the UpdateSelectionDetails method written in step 6.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/SelectionChanged_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/SelectionChanged_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SelectionChanged" border="0" alt="SelectionChanged" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/SelectionChanged_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/SelectionChanged_thumb.jpg" width="849" height="295" /></a> </p>  <p>&#160;</p>  <p>And lastly – there is a WindowClosed event which will allow you to remove your tab from playback and release any resources you may have tied up.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowClosed_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowClosed_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WindowClosed" border="0" alt="WindowClosed" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowClosed_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/WindowClosed_thumb.jpg" width="850" height="208" /></a> </p>  <p></p>  <p>&#160;</p>  <p><strong>Step 8:&#160; Turning it on</strong></p>  <p>At this point, you’ve finished creating the add-in and it’s ready to go.&#160; Just compile it and launch a new instance of Visual Studio.&#160; Once you’ve launched the new instance, you can look under the tools menu for “Add-in manager”.&#160; you should see your add-in listed and be able to turn it on.&#160; If you want your add-in always loaded, make sure to choose the enable on startup option.</p>  <p>Next, just run a webtest and see the results!</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ShowingTheTab_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ShowingTheTab_2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ShowingTheTab" border="0" alt="ShowingTheTab" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ShowingTheTab_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/Trackingviewstateusingawebtestplaybackad_EC99/ShowingTheTab_thumb.jpg" width="706" height="627" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>VSTS 2010 Load Test Feature – Multiple Loadtest Plug-ins</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/vsts-2010-load-test-feature-multiple-loadtest-plug-ins</link>
      <pubDate>Tue, 09 Jun 2009 17:22:47 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2009/06/09/vsts-2010-load-test-feature-multiple-loadtest-plug-ins/</guid>
      <description><![CDATA[&#160;  If you haven’t yet heard, Visual Studio Team System 2010 has reached Beta 1 and is available...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>If you haven’t yet heard, Visual Studio Team System 2010 has reached Beta 1 and is available for public download.&#160; (You can find a copy of it <a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=85520793-68fc-4361-a8b6-dc2cff49c8d2&amp;displaylang=en" target="_blank">here</a>).&#160; Over the next few days my colleagues and I will be writing up information about some of the most anticipated features for the load testing portion of the product.&#160; If you haven’t yet checked out <a href="https://blogs.msdn.com/edglas/archive/2009/05/18/dev10-beta-1-available.aspx">Ed Glas’s listing</a> of the newest web and load test features, I recommend taking a look.&#160; As we write up more of these blog entries, he will link to them directly from his list.</p>  <p>In this post, I’m going to describe how (and why) to use multiple load test plug-ins with your load tests.&#160; If you want to run code at specific times during the loadtest, the best way to do that is to write a loadtest plug-in.&#160; Prior to Visual Studio 2010 this functionality was available, but you were limited to one plug-in per loadtest.&#160; This can be less than ideal if you want to create reusable plug-in code since all of the code had to be crammed into the same plug-in, regardless of whether it was logically similar to do so.&#160; In Visual Studio 2010 we’ve made this quite simple.</p>  <p>1) Add your test plug-ins to your project and compile the project.</p>  <p>2) After creating your loadtest, right click on the test node in the loadtest editor, and choose “Add Load Test Plug-in”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/AddLTPlugin_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/AddLTPlugin_2.jpg"><img title="AddLTPlugin" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="244" alt="AddLTPlugin" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/AddLTPlugin_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/AddLTPlugin_thumb.jpg" width="235" border="0" /></a> </p>  <p>3) Select the plug-in you wish to add.&#160; From here, you can view its properties and set the initial values you wish for them to have at run time.&#160; Note that you can expose as many properties as you want from your plug-ins; just make them public, settable, and of a base type such as Integer, Boolean, or String.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginDialog_8.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginDialog_8.jpg"><img title="LTPluginDialog" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="273" alt="LTPluginDialog" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginDialog_thumb_3.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginDialog_thumb_3.jpg" width="393" border="0" /></a> </p>  <p>4) Click “Ok”, and the newly added Load Test plug-in will be shown in the editor tree.</p>  <p></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginList_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginList_2.jpg"><img title="LTPluginList" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="244" alt="LTPluginList" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginList_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/LTPluginList_thumb.jpg" width="165" border="0" /></a> </p>  <p></p>  <p>5) Repeat the process to add as many plug-ins as your loadtest will need.</p>  <p>6)&#160; If you’re worried about the order the plug-ins will execute, just click and drag the plug-ins to rearrange them.&#160; They will run in the order you have listed.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/multipleplugins_2.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/multipleplugins_2.jpg"><img title="multipleplugins" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="288" alt="multipleplugins" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/multipleplugins_thumb.jpg" original-url="https://blogs.msdn.com/blogfiles/mtaute/WindowsLiveWriter/VSTS2010LoadTestFeatureMultipleLoadtestP_D743/multipleplugins_thumb.jpg" width="308" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Diagnosing and fixing Web Test recorder bar issues.</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/diagnosing-and-fixing-web-test-recorder-bar-issues</link>
      <pubDate>Fri, 09 Nov 2007 14:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2007/11/09/diagnosing-and-fixing-web-test-recorder-bar-issues/</guid>
      <description><![CDATA[Since VSTS 2005 shipped there have been a variety of different questions raised by customers over...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Since VSTS 2005 shipped there have been a variety of different questions raised by customers over the years.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>One topic which comes up somewhat frequently is a disabled or nonexistent web test recorder bar when recording web tests.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Since it can be frustrating to diagnose and fix these problems, I’ve compiled a list of the most common reasons for this to happen and potential fixes for each. </FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>If you know of something that fits the “My web test recorder bar isn’t working” criteria and isn’t on the list, please let me know and I’ll try to add it.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2005 : Any OS : Recorder bar is not displaying when recording a webtest.<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Fix:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Upgrade to VSTS 2005 SP1.<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>There are a few bugs preventing the webtest recorder bar from displaying under certain circumstances that were fixed in SP1.&nbsp; If you're having trouble in VS 2005 and haven't yet upgraded to SP1, that's your first step.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2005 : Vista<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>: Recorder bar displays, but the controls are disabled.<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Fix:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Webtest recording using VS 2005 on Vista only works when running in elevated mode.&nbsp; [When launching VS 2005, right click the icon and choose to run as administrator]</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2005, 2008 : Windows 2003 / Vista : Recorder bar comes up, but the controls are disabled.<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Fix : the web test recorder bar does not work with IE enhanced security enabled.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>(VSTS 2008 will actually display an error message telling you this)<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>IE enhanced security can be removed from within the Control panel / Add Remove Programs / Windows Setup</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2008 : Vista, Win7&nbsp;(64 bit) : Recorder bar does not appear when recording a new webtest<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Fix:<SPAN style="mso-spacerun: yes">&nbsp; Vista caches the list of explorer bars you have available and the recorder bar was not included in your list.&nbsp; The fix is to force Windows to rebuild that cache.&nbsp; To do this, first make sure you have all Internet Explorer instances shut down, then open the 32 bit registry editor and&nbsp;delete the following keys:</SPAN></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri><SPAN style="mso-spacerun: yes"><EM>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}<BR>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}</EM></SPAN></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri><SPAN style="mso-spacerun: yes">[Note: by default, the 32 bit registry editor is located in %WINDIR%\SysWow64\RegEdt32.exe]</SPAN></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri><SPAN style="mso-spacerun: yes">The next time you boot Internet Explorer, your explorer bar cache will be rebuilt and the recorder bar should be available.</SPAN></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2005, 2008 : Any OS : Recorder bar does not appear when recording a new webtest<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Fix:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Make sure that you don’t have browser add-ons disabled.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Specifically, the web test recorder helper add-on needs to be enabled.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>For Internet Explorer 7, you can find this setting in Tools / Internet options / Program [tab] / Manage add-ons.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>From there, verify that Microsoft Web Test Recorder Helper is enabled.</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><B style="mso-bidi-font-weight: normal"><FONT size=3><FONT face=Calibri>VSTS 2008 : Any OS (IE 7) : When recording, a new web browser opens up and the new browser doesn’t have a recorder bar.<o:p></o:p></FONT></FONT></B></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Fix: <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>The reason for this is that by default, about:Blank is displayed in the browser when you start recording.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This website is (by default) in the internet security zone (protected mode: on).<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>When you open a website in a different zone (without protected mode) it will be handled by a new instance of internet explorer.<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>The fix is to do one of 2 things: a) Move about:blank into the zone where you’re attempting to record from or b) Change the default web page which is brought up when you start recording to something in the same zone as you’re trying to record.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>You can accomplish this by setting the following registry key</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest]</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>"StartingLocation"="</FONT><A href="https://server/website" mce_href="https://server/website"><FONT color=#0000ff size=3 face=Calibri>https://server/website</FONT></A><FONT size=3 face=Calibri>"</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri><STRONG>&nbsp;VSTS 2005, 2008, 2010 Beta 1 : Windows 7 : When launching the recorder, the recorder bar does not appear</STRONG></FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>Fix:&nbsp; The Windows 7 security model is slightly different than previous versions of windows. (go figure :)&nbsp;&nbsp; To get the recorder to show up, you'll have to run Visual Studio in elevated mode.</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri><STRONG>VSTS 2005, 2008, 2010 : IE 8 : While recording, the recorder bar will sometimes just stop working and tell me it wasn't launched from within Visual Studio</STRONG></FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>The issue here is yet again, security.&nbsp; In this case, when you cross the zones defined in IE.&nbsp; When you cross between different zones (by default, these&nbsp;are trusted sites, intranet and internet), Internet Explorer will actually kill your existing IE process and launch up a new one.&nbsp; This new IE process was, as the error message says, not launched by Visual Studio and hence the recorder cannot work.</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>Fix:&nbsp; There are multiple fixes for this problem, any one of which *should* work equally well.</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>1) Turn off "Protected Mode" in Internet Explorer.&nbsp; (Tools | Options | Security - There should be a checkbox to enable / disable protected mode)&nbsp; You'll need to reboot IE.</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>2) Change the initial URL which Visual Studio loads when recording a webtest to one in the same zone as you wish to record.&nbsp; The regkey to do this is below.&nbsp; Note that "9.0" here corresponds to the Visual Studio version you have installed.&nbsp; (2005 = 8.0, 2008 = 9.0, 2010 = 10.0)</FONT></o:p></P><o:p>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<STRONG>9.0</STRONG>\EnterpriseTools\QualityTools\WebLoadTest]</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>"StartingLocation"="</FONT><A href="https://server/website" mce_href="https://server/website"><FONT color=#0000ff size=3 face=Calibri>https://server/website</FONT></A><FONT size=3 face=Calibri>"</FONT></P></BLOCKQUOTE></BLOCKQUOTE>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>3) Run in elevated mode (I'm pretty sure that running in elevated mode will automatically turn off protected mode, so this is akin to fix #1 above.)</FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P></o:p>]]></content:encoded>
    </item>
    <item>
      <title>New Web Test Features in Visual Studio Team System for Software Testers 2008</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/new-web-test-features-in-visual-studio-team-system-for-software-testers-2008</link>
      <pubDate>Thu, 21 Jun 2007 15:50:00 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2007/06/21/new-web-test-features-in-visual-studio-team-system-for-software-testers-2008/</guid>
      <description><![CDATA[Visual Studio 2008 Beta 2 is just around the corner&nbsp;and here is a summary of a few of the...]]></description>
      <content:encoded><![CDATA[<P>Visual Studio 2008 Beta 2 is just around the corner&nbsp;and here is a summary of a few of the upcoming features you'll see:</P>
<P><STRONG>Support for initialization and termination tests per virtual user.</STRONG></P>
<P>In the past it's been difficult to manage operations which only have to be performed once at the beginning and/or end of a test.&nbsp; Things like login, checkout, creating a user, etc needed to be managed creatively to get to work.&nbsp; Visual Studio 2008 has first class support for initialization and termination tests, which, as their name implies are run at the beginning and ending of a virtual user sesson.</P>
<P>Adding them is easy.&nbsp; Just bring up the test mix editor (shown below), select the checkboxes at the bottom, and choose which test you want to be your initialization and / or termination test.</P>
<P>&nbsp;[Test mix editor]</P>
<P mce_keep="true"><IMG title="Test mix editor" alt="Test mix editor" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/03/44/77/77/Adding%20init-terminate%20tests.JPG" original-url="https://blogs.msdn.com/photos/mtaute/images/3447777/original.aspx" align=left mce_src="https://blogs.msdn.com/photos/mtaute/images/3447777/original.aspx"></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P><BR>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P>Once you've selected your init / terminate tests, the webtest editor shows them as part of your scenario:</P>
<P><IMG title="Web Test Editor" style="WIDTH: 660px; HEIGHT: 444px" height=444 alt="Web Test Editor" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/03/44/77/99/init-terminate%20in%20editor.JPG" original-url="https://blogs.msdn.com/photos/mtaute/images/3447799/original.aspx" width=660 align=left mce_src="https://blogs.msdn.com/photos/mtaute/images/3447799/original.aspx"></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG></STRONG>&nbsp;</P>
<P><STRONG>Multiple Web Test plug-ins and request level plug-ins:</STRONG></P>
<P>With multiple Web Test plug-ins, componentizing your code is much easier in VSTS 2008.&nbsp; You're not forced to cram all of the code you might need into a single plug-in so you're free to mix and match plug-ins across multiple projects without the extra overhead.&nbsp; Additionally, you can also expose public properties from your plug-ins to make them even more useful on a per-test basis.&nbsp; Here's a screenshot of what adding a Web Test plug-in looks like now:</P>
<P mce_keep="true"><IMG title="Adding a plug-in" style="WIDTH: 548px; HEIGHT: 428px" height=428 alt="Adding a plug-in" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/03/44/78/04/Adding%20a%20webtest%20plugin.JPG" original-url="https://blogs.msdn.com/photos/mtaute/images/3447804/original.aspx" width=548 align=left mce_src="https://blogs.msdn.com/photos/mtaute/images/3447804/original.aspx"></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">True request level plug-ins are now a reality as well.&nbsp; Just like Web Test plug-ins, you can have multiple request level plug-ins directly attached to a specific request rather than having to filter requests inside the plug-in.&nbsp; Of course, the request plug-in infrastructure from VSTS 2005 was not removed and&nbsp;your existing plug-ins will run without modification.&nbsp; In fact, they still provide a great way to run code after every request without adding a request plug-in to each node in the editor.&nbsp; Here's a look at the new Web Test editor with multiple plug-ins added:</P>
<P mce_keep="true"><IMG title="Web Test Editor with plug-ins" style="WIDTH: 537px; HEIGHT: 354px" height=354 alt="Web Test Editor with plug-ins" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/03/44/78/09/Multiple%20request%20and%20webtest%20plugins.JPG" original-url="https://blogs.msdn.com/photos/mtaute/images/3447809/original.aspx" width=537 align=left mce_src="https://blogs.msdn.com/photos/mtaute/images/3447809/original.aspx"></P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P mce_keep="true">Lastly - worried about the order your plug-ins will run?&nbsp; They run top-down in the order you see them in the UI!</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Managing goal-based load using multiple perfcounter thresholds</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/managing-goal-based-load-using-multiple-perfcounter-thresholds</link>
      <pubDate>Fri, 15 Dec 2006 17:12:00 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2006/12/15/managing-goal-based-load-using-multiple-perfcounter-thresholds/</guid>
      <description><![CDATA[As promised, here is a sample plug-in that I wrote a few months ago which people here may find...]]></description>
      <content:encoded><![CDATA[<P>As promised, here is a sample plug-in that I wrote a few months ago which people here may find useful.&nbsp; The purpose of this plug-in is to expand the functionality of goal-based load which ships with Visual Studio team test to allow you to have your load step up or down based on any number of performance counters.</P>
<P>For the plug-in to work, you need to have a few things set on your loadtest.</P>
<P><STRONG>Thresholds:</STRONG></P>
<P>For each perfcounter you intend to track, you need to set the warning and critical threshold values on that perfcounter.</P>
<P><STRONG>Context variables:</STRONG></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">MinLoad: &lt;The Minimum amount of load you wish to apply, regardless of perfcounter thresholds.&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">MaxLoad:&nbsp; &lt;The maximum amount of load you wish to apply, regardless of perfcounter thresholds.&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">LoadStep:&nbsp; &lt;The amount of load to step when increasing or decreasing.&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">LoadChangeInterval:&nbsp; &lt;How often you wish to change the load (in seconds and if necessary)&gt;</SPAN></P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">PerfCounter&lt;#&gt;:&nbsp;&nbsp; A path to the performance counter in the form: &lt;machine&gt;\&lt;category&gt;\&lt;instance&gt;\&lt;counter&gt;&nbsp; For example: COMPUTER_NAME\Processor\_Total\% Processor Time</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Note that you can have as many perfcounters as you wish to track, however you need to make sure they are sequential in number.&nbsp; (in other words, if you have PerfCounter1, PerfCounter2, and PerfCounter4 - PerfCounter4 will not be tracked.)</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><STRONG>Plug-in Code:</STRONG></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">using System;<BR>using System.Collections;<BR>using Microsoft.VisualStudio.TestTools.LoadTesting;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">/*<BR>&nbsp;* VariableLoadPlugin - Useful for using multiple performance counters with goal<BR>&nbsp;* based load profiles.<BR>&nbsp;* <BR>&nbsp;* Usage:&nbsp; Assign the following context parameters to your loadtest<BR>&nbsp;* MinLoad - The minimum amount of load to generate.<BR>&nbsp;* MaxLoad - The maximum amount of load to generate.<BR>&nbsp;* LoadStep - The amount of load increment / decrement by when attempting <BR>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to reach your target thresholds.<BR>&nbsp;* LoadChangeInterval - The number of seconds between load changes<BR>&nbsp;* Perfcounter# - A performance counter you wish tracked.&nbsp; The value should<BR>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; be of the form: &lt;computer&gt;\&lt;category&gt;\&lt;instance&gt;\&lt;counter&gt;<BR>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For example: Perfcounter1 : \MYCOMPUTER\Processor\_Total\% Processor Time<BR>&nbsp;* <BR>&nbsp;* Notes:<BR>&nbsp;* <BR>&nbsp;* 1) You can have as many perfcounters as you want, they just need to have sequential<BR>&nbsp;* context values.&nbsp; (e.g. Perfcounter1, Perfcounter2, Perfcounter3, etc)<BR>&nbsp;* 2) The plugin relies on Warning and Critical ThresholdExceeded events to fire in order<BR>&nbsp;* to adjust the load.&nbsp; That means you need to set Warning and Critical threshold values<BR>&nbsp;* as part of your loadtest for the perfcounters you want tracked.<BR>&nbsp;* 3) There is a bug in the RTM version of VSTT in which ThresholdExceeded events do<BR>&nbsp;* not fire reliably when a unit test is part of the loadtest mix.&nbsp; For this reason, it's<BR>&nbsp;* recommented that you don't use unit tests with this plugin.<BR>&nbsp;*/</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">namespace LoadtestPlugins<BR>{<BR>&nbsp; public class VariableLoadPlugin : ILoadTestPlugin<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; private ThresholdTracker m_thresholdTracker;<BR>&nbsp;&nbsp;&nbsp; private int m_minLoad;<BR>&nbsp;&nbsp;&nbsp; private int m_maxLoad;<BR>&nbsp;&nbsp;&nbsp; private int m_loadStep;<BR>&nbsp;&nbsp;&nbsp; private LoadTest m_loadTest;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * The loadtest plugin initialize event - Used to parse the user's<BR>&nbsp;&nbsp;&nbsp;&nbsp; * data out of the context object and set up the ThresholdTracker object<BR>&nbsp;&nbsp;&nbsp;&nbsp; * as necessary.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public void Initialize(LoadTest loadTest)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int contextIndex = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int intervalLength = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string currentCounter;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadTest = loadTest;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Assign MinLoad / MaxLoad / LoadStep and Interval based on context variables.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * If they don't exist, assign defaults of 1, 1000, 10, and 20 respectively.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AssignContextValueIfAvailable("MinLoad", ref m_minLoad, 1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AssignContextValueIfAvailable("MaxLoad", ref m_maxLoad, 1000);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AssignContextValueIfAvailable("LoadStep", ref m_loadStep, 10);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AssignContextValueIfAvailable("LoadChangeInterval", ref intervalLength, 20);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (null == m_thresholdTracker)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_thresholdTracker = new ThresholdTracker();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentCounter = String.Format("PerfCounter{0}", ++contextIndex);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (m_loadTest.Context.ContainsKey(currentCounter))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Add a lowercase version of the perfcounter into the ThresholdTracker<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_thresholdTracker.AddTrackedPerformanceCounter(m_loadTest.Context[currentCounter].ToString().ToLower());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentCounter = String.Format("PerfCounter{0}", ++contextIndex);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Allow the thresholdTracker to start tracking perfcounter data.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_thresholdTracker.StartTracking(intervalLength);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Attach the event handlers as necessary.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadTest.ThresholdExceeded += new EventHandler&lt;ThresholdExceededEventArgs&gt;(LoadTest_ThresholdExceeded);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadTest.Heartbeat += new EventHandler&lt;HeartbeatEventArgs&gt;(LoadTest_Heartbeat);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * The ThresholdExceeded event, executed by the loadtest engine when a perfcounter's<BR>&nbsp;&nbsp;&nbsp;&nbsp; * threshold (warning or critical) is violated.<BR>&nbsp;&nbsp;&nbsp;&nbsp; * This method passes that data into the ThresholdTracker object for consideration.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; void LoadTest_ThresholdExceeded(object sender, ThresholdExceededEventArgs e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string counterName;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Counters with no instance have a placeholder for the instance name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ("systemdiagnosticsperfcounterlibsingleinstance" == e.CounterValue.InstanceName)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; counterName = String.Format("{0}\\{1}\\{2}", e.CounterValue.MachineName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.CounterValue.CategoryName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.CounterValue.CounterName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; counterName = String.Format("{0}\\{1}\\{2}\\{3}", e.CounterValue.MachineName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.CounterValue.CategoryName, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.CounterValue.InstanceName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.CounterValue.CounterName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_thresholdTracker.ReportThresholdViolation(counterName.ToLower(), e.ThresholdResult);<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * The loadtest heartbeat event, executed once per second.<BR>&nbsp;&nbsp;&nbsp;&nbsp; * This method will check to see if the ThresholdTracker object recommends<BR>&nbsp;&nbsp;&nbsp;&nbsp; * a load change and perform the change.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; void LoadTest_Heartbeat(object sender, HeartbeatEventArgs e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int newLoad;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_thresholdTracker.IsStarted)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (m_thresholdTracker.CurrentLoadDirection)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdTracker.LoadDirection.None:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdTracker.LoadDirection.Decrease:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (LoadTestScenario scenario in m_loadTest.Scenarios)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newLoad = scenario.CurrentLoad - m_loadStep;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scenario.CurrentLoad = (newLoad &gt;= m_minLoad) ? newLoad : m_minLoad;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdTracker.LoadDirection.Increase:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (LoadTestScenario scenario in m_loadTest.Scenarios)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newLoad = scenario.CurrentLoad + m_loadStep;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scenario.CurrentLoad = (newLoad &lt;= m_maxLoad) ? newLoad : m_maxLoad;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Helper method for grabbing values from the context data or assigning<BR>&nbsp;&nbsp;&nbsp;&nbsp; * a default value if needed.<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Returns true if the value was found, false if the default value was used.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; private bool AssignContextValueIfAvailable(string contextKeyName, ref int target, int defaultValue)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_loadTest.Context.ContainsKey(contextKeyName))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target = Convert.ToInt32(m_loadTest.Context[contextKeyName]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target = defaultValue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; public class ThresholdTracker<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; public enum LoadDirection<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Increase = 0,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Decrease = 1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; None = 2,<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; private int m_intervalLength;<BR>&nbsp;&nbsp;&nbsp; private ArrayList m_counterList;<BR>&nbsp;&nbsp;&nbsp; private DateTime m_nextUpdateTime;<BR>&nbsp;&nbsp;&nbsp; private LoadDirection m_loadDirection;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; public ThresholdTracker()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_intervalLength = -1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_counterList = new ArrayList();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadDirection = LoadDirection.None;<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Method for adding new performance counters into the tracking array.<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Note that this does not guarantee that counter thresholds have been set,<BR>&nbsp;&nbsp;&nbsp;&nbsp; * only that that the perfcounter will be tracked if they are.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public bool AddTrackedPerformanceCounter(string perfCounter)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(null != perfCounter &amp;&amp; !m_counterList.Contains(perfCounter))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_counterList.Add(perfCounter);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Once a perfcounter has hit a threshold (be it critical or warning),<BR>&nbsp;&nbsp;&nbsp;&nbsp; * we track it here to determine if load should be affected or not.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public bool ReportThresholdViolation(string counter, ThresholdRuleResult thresholdResult)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (IsStarted &amp;&amp; m_counterList.Contains(counter))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (thresholdResult)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdRuleResult.OK:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Do nothing in this case, as we default to increasing load anyway.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdRuleResult.Warning:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Comment this section out if you want to bounce off of the upper end<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * of your highest threshold, only decreasing load when you hit your<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * critical edge.&nbsp; (This will allow for more perfcounters to sit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * between their warning and critical ranges, but will cause load to<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * be changed at every interval)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Leaving this section uncommented will keep your load at the low end<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * of your highest threshold (In other words, you'll stop increasing <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * load as soon as your highest tracked perfcounter hits its warning <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * threshold)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (LoadDirection.Increase == m_loadDirection)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadDirection = LoadDirection.None;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case ThresholdRuleResult.Critical:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Nothing to do here but decrease the load if we've violated a <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // critical threshold.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadDirection = LoadDirection.Decrease;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The perfcounter was being tracked.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Perfcounter wasn't tracked anyway.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * A property which provides a recommendation on whether to increase<BR>&nbsp;&nbsp;&nbsp;&nbsp; * or decrease the current load on the server in order to hit the <BR>&nbsp;&nbsp;&nbsp;&nbsp; * target perfcounter thresholds<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public LoadDirection CurrentLoadDirection<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!IsStarted)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new ApplicationException("Threshold tracker has not been started");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // No load changes if the interval time hasn't passed.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_nextUpdateTime &gt; DateTime.Now)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return LoadDirection.None;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The interval time has passed, let's change the load (if necessary)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_nextUpdateTime = DateTime.Now.AddSeconds(m_intervalLength);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Grab a copy of the current value so we can return it.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LoadDirection tempDirection = m_loadDirection;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Default to increasing load next time. (This will change if a <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * threshold is violated.)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_loadDirection = LoadDirection.Increase;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return tempDirection;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Readonly property for quick assessment on whether perfcounters are <BR>&nbsp;&nbsp;&nbsp;&nbsp; * being tracked or not.<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public bool IsStarted<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1 != m_intervalLength);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Allows this object to start tracking perfcounter data at specified<BR>&nbsp;&nbsp;&nbsp;&nbsp; * intervals<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public void StartTracking(int intervalLength)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Use the default of 20 seconds if they fail to specify a valid interval.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_intervalLength = (intervalLength &gt; 0) ? intervalLength : 20;<BR>&nbsp;&nbsp;&nbsp; }</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp; * Forces the class to stop keeping track of perfcounter threshold violations<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public void StopTracking()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!IsStarted)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new ApplicationException("Threshold tracker has not been started");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_intervalLength = -1;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>}<BR>&nbsp;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"></SPAN>&nbsp;</P></SPAN>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>A new beginning.</title>
      <link>https://docs.microsoft.com/archive/blogs/mtaute/a-new-beginning</link>
      <pubDate>Fri, 15 Dec 2006 16:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Michael Taute - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mtaute/2006/12/15/a-new-beginning/</guid>
      <description><![CDATA[Hi all,
I recently joined the Visual Studio Team Test group as a Software Design Engineer in...]]></description>
      <content:encoded><![CDATA[<P>Hi all,</P>
<P>I recently joined the Visual Studio Team Test group as a Software Design Engineer in Test.&nbsp; After spending the last 9 years working on various portions of Office, the developer organization is a breath of fresh air.</P>
<P>From time to time I will update this blog with neat little tidbits that I've picked up or perhaps code samples for plug-ins that I've written and think that people might find useful.&nbsp; If you have questions regarding my blog posts or the content therein, feel free to comment here directly and I'll get back to you.&nbsp; However, if you have a general question regarding VSTS&nbsp;the best place to go for an answer is the VSTS forum page, located here:&nbsp; <A href="https://forums.microsoft.com/msdn/showforum.aspx?forumid=19">https://forums.microsoft.com/msdn/showforum.aspx?forumid=19</A>.</P>
<P>--Mike</P>]]></content:encoded>
    </item>
  </channel>
</rss>