Click to Rate and Give Feedback
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Team Test API
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)

Visual Basic (Declaration)
<SerializableAttribute> _
Public MustInherit Class WebTest
Visual Basic (Usage)
Dim instance As WebTest
C#
[SerializableAttribute] 
public abstract class WebTest
C++
[SerializableAttribute] 
public ref class WebTest abstract
J#
/** @attribute SerializableAttribute() */ 
public abstract class WebTest
JScript
SerializableAttribute 
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.

C#
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;
        }
    }
}
System.Object
  Microsoft.VisualStudio.TestTools.WebTesting.WebTest
     Microsoft.VisualStudio.TestTools.WebTesting.ThreadedWebTest
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker