56.1. Web Tests
These tests will simulate web requests and allow you to inspect the responses and evaluate different conditions to determine if the test passes. To create a new Web Test, right-click your Test Project from the Add submenu and select Web Test. This will open Internet Explorer with the Web Test Recorder enabled as shown in Figure 56-1. Point to your site as if you were a normal user and interact with your application. Once done, simply click Stop. This will open the Web Test's designer shown in Figure 56-2. There you can customize your test, adding validation and extraction rules, context parameters, comments, data sources, and calls to other Web Tests, or inserting transactions.
You will often need to run the same set of tests against different web servers; to do this you configure this as a context parameter. From the Web Test Designer you can right-click the main node and select Parameterize Web Servers. Visual Studio will inspect the URLs in each request and determine the context parameters it will need to create.
You can link your requests using the output from one of them as input for the next; to do this you add extraction rules to a specific request. You can extract from fields, attributes, http headers, hidden fields, and text, or even use regular expressions. The result of an extraction will set a context parameter, which can then be used, for example, as a form or query string parameter in further requests. You could add a product and then search for it ...