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)

Syntax
Visual Basic (Declaration)
<SerializableAttribute> _
Public MustInherit Class WebTest
[SerializableAttribute]
public abstract class WebTest
[SerializableAttribute]
public ref class WebTest abstract
/** @attribute SerializableAttribute() */
public abstract class WebTest
SerializableAttribute
public abstract class WebTest

Remarks
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.

Example
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 : <b>WebTest</b>
{
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
<ExtractionEventArgs>(rule1.Extract);
ExtractCheckBoxes rule2 = new ExtractCheckBoxes();
rule2.FindCheckedBoxes = false;
rule2.ContextParameterName = "";
request1.ExtractValues += new EventHandler
<ExtractionEventArgs>(rule2.Extract);
yield return request1;
}
}
}

Inheritance Hierarchy

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

See Also