Share via


DataSourceAttribute Class

Contains information that describes a data source for a Web test. This class cannot be inherited.

Namespace:  Microsoft.VisualStudio.TestTools.WebTesting
Assembly:  Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True)> _
Public NotInheritable Class DataSourceAttribute _
    Inherits Attribute
'Usage
Dim instance As DataSourceAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true)]
public sealed class DataSourceAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true)]
public ref class DataSourceAttribute sealed : public Attribute
public final class DataSourceAttribute extends Attribute

Remarks

The data source cannot be changed based on input during a test because all the data is loaded and cached before the first test runs. To change data sources at run-time, you can implement your own data binding. Use ADO.NET or a StreamReader when you read from a file.

This attribute can be applied to classes. This attribute can be applied multiple times. For more information about how to use attributes, see Extending Metadata Using Attributes.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.VisualStudio.TestTools.WebTesting.DataSourceAttribute

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

Reference

DataSourceAttribute Members

Microsoft.VisualStudio.TestTools.WebTesting Namespace

Other Resources

Connecting to a Data Source (ADO.NET)

About Data Binding in Web Tests

How to: Add Data Binding to a Web Request