This documentation is archived and is not being maintained.

WebTest Class

Base class for all Web tests. Coded Web tests that are written in C# derive directly from this class.

Namespace: Microsoft.VisualStudio.TestTools.WebTesting
Assembly: Microsoft.VisualStudio.QualityTools.WebTestFramework (in microsoft.visualstudio.qualitytools.webtestframework.dll)

public abstract class WebTest
/** @attribute SerializableAttribute() */ 
public abstract class WebTest
public abstract class WebTest

To create a coded Web test in Visual Basic 2005, see ThreadedWebTest.

For a list of initial property values for an instance of WebTest class, see the WebTest constructor.

For more information about how to run a test outside Visual Studio 2005 Team System, see Command-Line Test Execution.

This class is serializable.

Notes to Inheritors When you inherit from WebTest, you must override GetRequestEnumerator.

The following Web test extracts values that represent the status of check boxes and adds the values to the context.

namespace TestProject1
    using System;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using ClassLibrary2;

    public class MyWebTest : WebTest
        public MyWebTest()
            this.PreAuthenticate = true;

        public override IEnumerator<WebTestRequest> GetRequestEnumerator()
            WebTestRequest request1 = new WebTestRequest("http://localhost/ts");
            ExtractCheckBoxes rule1 = new ExtractCheckBoxes();
            rule1.FindCheckedBoxes = true;
            rule1.ContextParameterName = "CheckedBoxes";
            request1.ExtractValues += new EventHandler
            ExtractCheckBoxes rule2 = new ExtractCheckBoxes();
            rule2.FindCheckedBoxes = false;
            rule2.ContextParameterName = "";
            request1.ExtractValues += new EventHandler
            yield return request1;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.