One of the nice things in Visual Studio’s load test framework is the ability for a webtest to include calls to other webtests. This allows you to compose complex scenarios from a bunch of simple .webtests. In fact my load test uses statistical modelling to dynamically decide which tests its going to call.

If your webtest includes User Name / Password properties then you need to set the ‘Inherit Web Test Settngs‘ to True. Otherwise the called webtest won’t use the same credentials that the calling test is using. Especially in situations where you are running with Controllers and Agents you will probably need to set this setting.

Lets assume we have Webtest1 and it includes several calls to Webtest2. This has a few consequences you need to be aware of and deal with:

  1. Any WebTestPlugins in Webtest1 will execute when Webtest1 starts and each time Webtest2 starts. You probably don’t want that. Many people use the ‘Generate GUID’ plugin to store a unique ID in the context for the test session. However in this case the context parameter’s value will change every time one of the webtests is started. In my opinion its best to avoid using any WebTestPlugins on webtests that call to other webtests.
  2. Any validation rules in Webtest1 will also be applied to all requests in Webtest2. This can be problematic if webtest2 needs less or different validation.
  3. If webtest2 includes a call to webtest3, then webtest3 will also show the above issues.