Monday, January 22, 2007

VSTS Load Test Simulating Browser Cache

Below are some notes that can allow the Load Test containg Web Tests to attempt simulating the caching behavior of the browser

  • There is a property named on each request in a Web test named “Cache Control” in the Web test editor (and named “Cache” on the WebTestRequest object in the API used by coded Web tests)
  • When the Cache Control property on a request in the Web test is false, the request is always issued.
  • When the Cache Control property is true, the VSTS load test runtime code attempts to emulate the Internet Explorer caching behavior (with the “Automatically” setting) as described in this article:
    (This includes reading and following the HTTP cache control directives.)
  • The Cache Control property is automatically set to true for all dependent requests (typically for images, style sheets, etc embedded on the page).
  • In a load test, the browser caching behavior is simulated separately for each user running in the load test.
  • When a virtual user in a load test completes a Web test and a new Web test session is started to keep the user load at the same level, sometimes the load test starts simulates a “new user” with a clean cache, and sometimes the load test simulates a return user that has items cached from a previous session.
    This is determined by the “Percentage of New Users” property on the Scenario in the load test.
    The default for “Percentage of New Users” is 100 in which case all user sessions are started with a clean cache.
    This is probably not correct for most applications where there are return users, so users should consider the most appropriate value to use for this setting depending on the actual usage of the application being load tested.

There was a bug in the original release of Visual Studio 2005 Team System that is fixed by the SP1 update where the load test was not honoring the “max-age” cache control directive.

No comments: