Ed Glas's blog on VSTS load testing

  • InfoPath WebTests on CodePlex!

    The InfoPath team has written a set of WebTest plugins that enable testing InfoPath with a WebTest.

    See the project on codeplex here: http://www.codeplex.com/ipfswebtest

    The project contains custom extraction rules, a sample web test, and a doc on how to use them.

    These tests are difficult to script from scratch, so it is great to see this project with the necessary extraction rules already coded and docs on how to use them.

    Many thanks to the support of the InfoPath test team on this, especially John Booze and Mary Smith.

    Ed.

  • 84,248 Ads per second!

    The adCenter Display Ads Platform team recently ran a large test using VSTS. The goal of this testing was to validate the configuration and stability of 100+ servers under load.

    The test used one Controller and 42 agents to produce the necessary load.  The controller was also hosting a full install of SQL Server which acted as the result store.

    Controller and Agent hardware information

    Processor:  4 x AMD Opteron 280 (2405  MHz)

    Memory:    4 GB RAM

    Network:   GigE NIC

    High level test summary

    Test Duration                               12 hours

    Total requests generated             3,639,518,000 (3.63 Billion requests)

    Average requests/sec                   84,248

    Average Requests/Test                1

    Failed Tests                                  0

    Sampling rate                               30 secs

    Average agent Proc utilization    45%

    To minimize the risk they started off with one controller and one agent, then increasing to 8 agents, then going to 42.

    They estimate they could have produced at least 50% more requests with 42 agents but restricted the load to avoid any agent overloading.

    A note from the customer: Overall it was a happy experience running a test of this large scale. Thanks to VSTS for making load testing a pleasure!

    :)

    Ed.

  • Databinding in Web Tests

    Check out Sean's nice new post on Access Methods in Web Test Data Sources. I've also added this to my Content Index for Web Tests and Load Tests page.

    Ed.

  • WCF Load Tests!!!

    This is late in coming, but Rob Jarratt has published the WCF recording tool he has been working on to CodePlex at http://www.codeplex.com/wcfloadtest.

    This is a really cool tool that will convert a WCF log file into a unit test that will replay the log. It came out of a load test engagement the services test labs did with a customer, so it is a proven solution.

    If you are doing load testing on WCF, this tool provides a way to essentially record and playback the WCF traffic from an application.

    I've added a link to the project on my Links to Content Index for Web Tests and Load Tests page.

    Ed.

  • SharePoint MVP load tests SharePoint

    Liam Clearly recently used VSTS to test SharePoint and ran into a bug in the web test recorder. See his post here.

    The bug is that the recorder drops requests if the content-type is not set in the response. In this case, the page redirects to another page, but the initial response (the redirect) does not have a content-type header set.

    In the resultant web test, it looks like the recorder simply dropped the form post parameters, when in fact the entire request was missed.

    We have built a QFE to fix this problem, which is scheduled to be available later this week. We've seen the bug crop up on other sites as well.

    Interestingly, we had tested SharePoint before we shipped, but this regression was introduced pretty late in the cycle and we did not have this test case covered in our automated suites that we run in the end game.

    Ed.

  • Are Web Tests "Functional" tests?

    When most people talk about automated functional testing, they are talking about UI Automated functional testing, where the test drives the UI (clicks buttons, types in text, etc.).

    In fact there are many other strategies for functional testing, and most “unit tests” written today are not true Unit tests (with a capital U) that isolate and only test a single class, but test from the API down. For example, a unit test that tests a web service, or a client API that hits a server, are really functional tests.

    Web tests work at the http layer, as Sean explains in this blog post. Really a better name for these is "Web Server Tests", or "Web Application Tests" since they actually test the server. The first thing users think when they see "web test" is a test that drives the browser. The browser preview window in web test playback only adds to this confusion.

    Web tests do not actually instantiate IE when running, but only send and receive http requests. The main reason we chose to drive web tests at the HTTP layer is we wanted to be able to drive load efficiently in a load test. Instantiating IE, even just the guts of IE (the web browser control), consumes a lot more memory and constrains the amount of load that can be generated from a single machine. Web tests are super-efficient when running.

    So what does and does not get tested by a web test? Obviously you can test your server code this way, which is super-valuable as that’s where most of your business logic is. Given a particular request, you can validate that the server sends back the correct response. However, since the test is not driven through IE, it will not test any client side code or behaviors, such as any java script code (including Ajax code). However, you can simulate the HTTP requests that Ajax will make and validate that the server is sending back the right response. Web tests do validation using Validation Rules, which enable you to validate the response sent back by the server.

    There are advantages and disadvantages to driving at the protocol layer vs. the UI. UI tests are easier to understand and debug, but more fragile. To really be effective at scripting web tests you have to understand what is happening at the http layer, which most developers and testers are not usually concerned with. Most are . Also doing things like adding validation is easier in a UI automation tool, harder in web tests (although this is more a tooling problem than protocol vs. UI, we have some features lined up to make this easier).

    So the bottom line answer is "yes", web tests are functional tests, but they work at the http layer rather than the UI layer.

  • Updated Content for web tests and load tests

    I've updated my collection of links for info on web tests and load tests.

    I had been publishing this to a sticky post on the forum, but ran into the size limit so I'm moving it to my blog.

    The page is here. Do let me know if you hit any links that are broken, the content gets moved around from time to time.

    Ed.

  • Web Test Authoring and Debugging Techniques for VS 2008

    Web Test Authoring and Debugging Techniques for VS 2008

    In Visual Studio 2008, many new features were implemented that eliminate the top issues found in the VS 2005 Web Test recorder, as covered in the white paper Web Test Authoring and Debugging Techniques.

    While many areas have been addressed, there will still be times when record/playback fails or does not give the desired result. I’ll be writing a series of blog articles on how the recorder works, “knobs” in the registry that will let you control what does and does not get recorded, and problems you may encounter. Finally, I’ll introduce new debugging techniques that will enable you to find and fix your tests.

    New Recorder Technologies in VS 2008

    The VS 2008 recorder introduced two key new technologies that eliminate the majority of the problems encountered in the VS 2005 recorder:

    1)      The new recorder now picks up all requests, whereas the 2005 recorder did not record AJAX request or certain types of popup requests, and

    2)      The new recorder has a feature to detect dynamic parameters and automatically add the extraction rules and bindings to the test to properly correlate them. A common class of these parameters was dynamic parameters on the query string, such as a session id.

    3)      If a page has a redirect, the Expected Response URL records the page that was redirected to. In VS 2005, a redirect to the error page was not detected as an error. In VS 2008 the recorder adds the Response URL validation rule to catch this and flag it as an error.

    Filtering Requests

    Even though the recorder now captures all requests, some requests are still filtered when the web test is generated.

    First of all, “dependent” requests are filtered. Web Test has a feature to “Parse Dependent Links”, in which resources on a page such as images, java scripts sources, and css references are not recorded, but at run time the web test engine parses the response, finds all references to dependents, and then fetches them.  This works the same way in VS 2008. When the parser runs, it looks for all IMG, SCRIPT, and LINK tags to find the dependent resources and fetch them.

    However, a web page can also download content using java script. There was a “hole” in the VS 2005 recorder, in that it could not pick up these requests.  A couple of examples of this are mouse over images that are fetched via java script, or images fetched in a mapping program via AJAX calls.

    By default, the recorder is configured to filter “static” content such as images and css files. You can override what gets recorded using these registry settings below. These settings are the default (set in code, these registry entries aren’t present after install):

    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest]
    "WebTestRecorderMode"="exclude"
    "ExcludeMimeTypes"="image;application/x-javascript;application/x-ns-proxy-autoconfig;text/css"
    "ExcludeExtensions"=".js;.vbscript;.gif;.jpg;.jpeg;.jpe;.png;.css;.rss"

    You can see that these settings will filter out images, java script source files, and css files. If you want to record everything, you can simply set “ExcludeMimeTypes” and “ExcludeExtensions” to the empty string.

    The recorder will also work in an “include” mode, where you specify a list of mime types and extensions to include. For example, the default include list is:

    Windows Registry Editor Version 5.00

     

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest]

    "WebTestRecorderMode"="include"

    "IncludeMimeTypes"="text/html;text/xml;text/xhtml;application/xml;application/xhtml+xml;application/soap+xml;application/json"

    "IncludeExtensions"=""

    Note you have to include the xml, soap, etc., in order to pick up ajax calls.

    Folding in Additional Requests

    One thing the recorder is not smart about is that requests picked up by the low level recorder are always treated as top-level requests. If you do set the recorder to include images and such, it does not try to figure out which request the dependent came from and store it under the appropriate top-level request. Instead any additional requests are recorded as top-level requests.

    Also, asynchronous requests are recorded at the top level of the web test and will be played back synchronously. We hope to add an “Async” property to top-level requests in our next release that will enable you to more accurately simulate the request pattern generated by the browser for AJAX requests.

    Note that dependents are fetched in parallel over two connections in the same way the browser fetches them.

    Filtering HTTP Headers

    HTTP header filtering works in a similar way to request filtering.

    Normally in a web test, most HTTP headers are set from the browser template file. Here are the contents of the IE7 browser template file:

    <Browser Name="Internet Explorer 7.0">

      <Headers>

        <Header Name="User-Agent" Value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />

        <Header Name="Accept" Value="*/*" />

        <Header Name="Accept-Language" Value="{{$IEAcceptLanguage}}" />

        <Header Name="Accept-Encoding" Value="GZIP" />

      </Headers>

    </Browser>

     

    Notice the MSIE 7.0 in the User-Agent header, which identifies it as IE7.

    By default, the recorder only records these additional HTTP headers:

    Windows Registry Editor Version 5.00

     

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest]

    "RequestHeadersToRecord"="SOAPAction;Pragma;x-microsoftajax"

     

    Your application may send additional custom headers. In that case, you can change the recorder settings to add the headers your app sends.

    The recorder is set to never record these headers, which are automatically handled in the HTTP engine:

    "Authorization", "Proxy-Connection", "Connection", "Host", "Expect", "Content-Length"

    Recorder Settings Summary

    You can see the new web test recorder is powerful, but the default settings may night be right for your application.

    1.       The default filtering of static content may mask performance problems in your application. Consider recording additional requests.

    2.       HTTP Headers that your application depends on may be filtered out. If your application uses custom headers, consider changing your recorder settings to pick them up.

    Detecting Dynamic Parameters

    A major new feature in VS 2008 is the ability to detect dynamic parameters. A dynamic parameter is a parameter whose value is generated each time a user runs the application, and therefore playback of recorded values won’t work.

    The best example of this is a dynamically generated session ID. For apps that support login, each time a user logs in, the server generate s a unique session ID to track the user. This session ID may then be passed back to the server via a cookie, form field, or query string parameter. In VS 2005, Web tests handled cookies and hidden fields. Note there were some bugs in hidden field binding in VS 2005, some of which were fixed in SP1 and some have been fixed in VS 2008.

    VS 2008 adds support for two more types of dynamic parameters: query string parameters and form fields (other than hidden fields).

    The way it works is at record time, the value of each form post and query string parameter is recorded, and an appropriate extraction rule is computed. Immediately after recording the web test is played back by the correlation tool. During playback, the tool applies the extraction rule and compares the extracted value with the recorded value. If they differ, it flags the parameter as a dynamic parameter.

    Dynamic Detection Playback Fails

    A subtle problem you may encounter is Dynamic Detection playback failing. As mentioned above, in order to detect dynamic parameters, the web test is played back under the covers. If this playback fails you may or may not get a complete list of parameters to promote. You can see whether or not it failed by looking in the result window, where the result of the playback is displayed. If it does fail, fix your test per the guidance below and then re-run dynamic parameter detection from the web test toolbar.

    When to not Promote a Parameter to a Dynamic Parameter

    There may be times when playback thinks a parameter is dynamic when in fact it is not.

    One example of this is when cookies in IE are used to populate form fields. For example, our Web test forums provide an option to save your user name for login. If you record a Web test with this setting turned on, a cookie is used to set the value of the user name so it is automatically filled in. When dynamic parameter detection runs, it looks at the user name value and sees that it is different than the recorded value. Aha! A dynamic parameter! If you accept this as a dynamic parameter, the web test engine will scrape the value out of the response rather than playing back what you typed in, clearly not the desired behavior.

    To avoid problems like this, clear your browser cookie cache prior to recording.

    Playback Doesn’t Work, Now What?

    In general, the problem is that the http requests sent by the web test engine are somehow different than the requests sent by IE. The first challenge is figuring out what IE is sending over http. There are different tools for doing this, include Fiddler (http://www.fiddler2.com/), or NetMon. There is also a new feature in the web test recorder for generating a recording log from a recording. Turning this on is probably the easiest way to see what IE is sending.

    Common Problems to Look For

    Common problems we’ve seen customers encounter:

    1)      Missing custom HTTP headers. See the comments on HTTP headers in the recorder section above.

    2)      Cookies saved on your local machine.  A good example of this is cookies stored on your machine to automatically fill out the user name. See the section on Detecting Dynamic Parameters above.

    Using the Recorder Log

    To turn on the recorder log, set these registry entries:

    Windows Registry Editor Version 5.00

     

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\EnterpriseTools\QualityTools\WebLoadTest]

    "CreateLog"=dword:00000001

    "RecorderLogFolder"="c:\\RecorderLogs\"

     

    This will result in a log file for each recording session. Open the log file and find the failing request, then carefully compare all parts of the request in the request log to the request in web test playback:

    ·         URI

    ·         Query string parameters and values

    ·         HTTP headers, including custom headers and cookies

    ·         Post body

    Once you identify the difference, you can go back to the web test to fix the problem. Some areas to look out for:

    ·         Missing custom http headers in the web test

    ·         Incorrectly handled dynamic parameters (including

    o   parameters marked as dynamic that aren’t, or )

    o   Incorrect extraction rules

    Using Fiddler

    Because of the underlying technology, there may be times when either the web test recorder or web test playback viewer does not accurately reflect what is actually getting sent over the wire in subtle ways. There may even be times when the web test recorder interferes with the requests sent by IE. To get a true picture of what is getting sent, you can use a tool like Fiddler or NetMon.

    One example of this is in VS2005, web test playback always showed cookies being sent in a single header, when in fact they were sent in multiple http headers.

    You can also configure Fiddler to run while the web test is running to capture the http traffic the web test is sending. To do this, you need to create a web test plugin and add this code to the constructor:

                this.Proxy = "http://localhost:8888";
                WebProxy webProxy = (WebProxy)this.WebProxy;
                webProxy.BypassProxyOnLocal = false;

    Web Test Logging

    Web test playback is a great tool for seeing what is going on in the web test engine. However, there may be times when you just want to dump the entire session to a text file. One limitation in Web test playback is there is no way to search across all the requests and responses in the session. We have developed a web test logging sample plugin that will do just that and plan to release it to CodePlex soon at http://www.codeplex.com/TeamTestPlugins.

    Conclusion

    Record playback in VS 2008 has been vastly improved over VS 2005. The recorder now has the capability to pick up all requests sent from IE, the Dynamic Parameter Detection feature catches the most common cases for dynamic parameter correlation, the Response URL validation rule, and a number of bugs have been fixed to make playback more reliable. Even with these new features, there may be times where the recorder by default isn’t capturing the meaningful requests for your application, and you will want to tweak the recorder settings to record additional requests.

    There may also be times where record/playback will fail, and you will need to debug the web test to figure out what is going wrong. The addition of the recorder logging feature will make this easier.

  • What do all those counters mean?

    We get asked a lot about what the various counter mean in a load test, like requests/sec, response time, tests/sec, etc. 

    The counters are documented here: http://msdn2.microsoft.com/en-us/library/ms404656(VS.80).aspx.

    Whenever I look for this page, I can't find it because it is not in the most intuitive place in the TOC, and for some reason the search engines don't return it when I search for specific counter names.

    Ed.

  • New web test plugin for scripting with a web test

    Check out this cool new web test plugin written by Neil Kidd on the UK development team. It enables you to write expressions for form post and query string parameter values. Without this tool, you have to go to code, either by writing a request plugin or by converting your web test to a coded web test.

    Screen shot of expressions

    Ed.

  • Web Test Recorder bar not showing up

    We’ve seen an odd problem on some machines where the initial user on Vista 64 doesn’t work. The work around is to delete your user settings, then the problem goes away.

    1. Go to control panel
    2. Open system
    3. Click advanced
    4. Click User Profiles
    5. Find yours and delete it
    6. Log back into the machine with your account and create a web test.

    We've seen sporadic reports on VS 2005 where the recorder bar comes up but is disabled. One fix is to reset your IE settings (above approach will work for this). In this post Darren Blackett narrowed his problem down to setting this registry key:

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BrowseNewProcess] "BrowseNewProcess"="yes"

    Ed.

  • New Microsoft Tester Center Launched!

    We launched the Tester Center today, a new web site for the test community.

    Here you'll find links to guidance, tester blogs, articles, videos on testing, a forum, in short a whole host of valuable content for testing.

    Ed.

  • Agent Setup and Agent/Controller network connections

    Check out Durga's blog post on setting up an agent in workgroup mode.

     One thing I noticed is that the install guide is incorrect, as it says that the "Simple File Sharing" is turned off when installing on XP in workgroup mode. You have to clear that manually. I have corrected that in my post.

     I also put together a visio diagram that shows which ports are used during setup and when the agent and controller run tests.

     

    And here are the connections used during agent setup:

     Ed.

  • What does deployment do when running a test?

    A lot goes on in deployment. Michael Koltachev, developer of the feature, recently sent an email explaining it to one of our testers:

    ·         In Orcas we introduced a way to run tests with deployment disabled. In this case, we execute the tests from where they are, such as bin\debug directory. There is persisted public property exposed in Run Config UI: IsDeploymentEnabled. When deployment is disabled, certain scenarios are disabled as well, for instance “rerun original tests” is disabled.

    ·         For local runs, only 1 deployment directory is used for all components, TMI, Controller, Agent.

    ·         For Remote runs, TMI uses local directory, then Controller uses different local directory on the Controller machine, then Agent uses different deployment directory on the Agent machine. It does not matter, if these all are the same machine.

    ·         TMI deployment:

    o   what we deploy and the order:

    §   Tests storages (the files that tests are stored in)

    ·         Executable files (e.g. unit tests and coded web tests)

    ·         PDB files

    ·         XML files (.webtest, .loadtest, etc.)

    ·         .config files

    §  Check whether deployment is from a trusted location (we require full trust on the “deploy from” files for test storages).

    §  Code coverage items (including those for in-place coverage)

    §  Run Config deployment items

    §  Deploy Dependencies of test storages

    ·         We check all dependencies recursively from assembly manifest file.

    ·         There is a way to disable dependency check for certains assemblies: use persisted regex property RunConfig.IgnoredDependentAssemblies.

    §  Per test deployment items

    §  If deployment of satellite assemblies is enabled (disabled by default for perf) in Run config, find & deploy them.

    §  For all deployment items we deploy PDB files (introduced in Orcas).

    §  Generate warnings for missing dependencies:

    ·         If there is a file with the same name and timestamp deployed from different directory to the same output directory,, we don’t generate a warning.

    ·         We generate warnings for all missing dependencies.

    o   Where we look for files:

    §  It the item has explicitly specified path, we use it

    §  Use RunConfig.SearchPaths, which is Solution Directory for IDE and “.” for command line. Also I don’t remember what happens in the big build scenario but as far as I remember, it specifies some explicit search paths.

    §  For each test storage processed, add directory of where it is located to the search paths

    §  Add the directory of where .testrunconfig file used is located to the search paths.

    o   Differences IDE from command line

    §  When run form IDE, all references recursively of current test project are added as deployment items

    o   Other notes

    §  NC introduced ITestElementDeploymentRuleProvider (implemented by a TIP on the same instance that implements iTestElement)

    ·         ImpliedDeploymentItems (e.g. a web test can specify additional items)

    ·         ImpliedDeploymentAssemblies (similar to above but the items that are checked for dependencies)

    ·         RequiresFullDeployment.

    ·         Reverse deployment:

    o   In the end of test run some files need to be deployed back from Agent to the client.

    §  Coverage result files

    §  Any other files put by a test or Agent/Controller to the In directory.

    §  For local runs, all files are placed to the same dir, “In”

    §  For remote runs, we create subdirs under each “In” directory for each agent, such as: “In\Agent1”, “In\Agent2”. The idea is that otherwise the files may collide for different agents. Then we merge files from all agents.

    ·         Deployment between TMI and Controller, and between Controller and Agent

    o   Deployment is done before test run is started.

    o   We don’t’ use File.Copy, we use file streams over .Net Remoting channels.

    Ed.

  • New VSTS Testing Videos on ASP.NET website

    Here is a nice set of short, focused videos hosted on ASP.NET: New Testing Videos on ASP.NET

     

    #1 | Introduction to Unit Testing with Team System (10 minutes, 54 seconds)

    #2 | Introduction to Testing Web Applications with Team System (9 minutes, 43 seconds)

    #3 | Introduction to Load Testing Web Applications with Team System (9 minutes, 8 seconds)

    #4 | Introduction to Manual Testing with Team System (8 minutes, 56 seconds)

    #5 | Introduction to Managing and Running Tests with Team System (8 minutes, 37 seconds)

    #6 | Measuring the Business Value of AJAX (10 minutes, 27 seconds)

    #7 | Code Coverage of Automated Tests (6 minutes, 49 seconds)

    #8 | Custom Extraction Rules and Coded Web Tests (12 minutes, 39 seconds)

    #9 | The Effects of Caching (15 minutes, 36 seconds)

    #10 | Using the Load Test Agent (5 minutes, 43 seconds)

    #11 | The Effects of ViewState (10 minutes, 4 seconds)

    #12 | How Do I: Integrate Defect Tracking with Testing? (8 minutes, 2 seconds)

    #13 | How Do I: Create My Own Bug Work Item? (11 minutes, 23 seconds)

    #14 | How Do I: Write Code More Quickly with Unit Tests? (8 minutes, 40 seconds)

    #15 | How Do I: Practice Test-Driven Development? (8 minutes, 21 seconds)

     

    Ed.

More Posts Next page »

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker