Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TestContext Class

 

Used to store information that is provided to unit tests.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

System::Object
  Microsoft.VisualStudio.TestTools.UnitTesting::TestContext

public ref class TestContext abstract 

NameDescription
System_CAPS_protmethodTestContext()

Initializes a new instance of an object that derives from the TestContext class.

NameDescription
System_CAPS_pubpropertyCurrentTestOutcome

You can use this property in a TestCleanup method to determine the outcome of a test that has run.

System_CAPS_pubpropertyDataConnection

When overridden in a derived class, gets the current data connection when the test is used for data driven testing.

System_CAPS_pubpropertyDataRow

When overridden in a derived class, gets the current data row when test is used for data driven testing.

System_CAPS_pubpropertyDeploymentDirectory

Gets the directory for files deployed for the test run. This property typically contains a subdirectory of TestRunDirectory.

System_CAPS_pubpropertyFullyQualifiedTestClassName

Gets the fully-qualified name of the class that contains the test method that is currently running.

System_CAPS_pubpropertyProperties

When overridden in a derived class, gets the test properties.

System_CAPS_pubpropertyRequestedPage

Gets the requested page.

System_CAPS_pubpropertyResultsDirectory

Gets the top-level directory that contains test results and test result directories for the test run. This is typically a subdirectory of TestRunDirectory.

System_CAPS_pubpropertyTestDeploymentDir

Gets the path to the test deployment directory. Deprecated. Use DeploymentDirectory instead.

System_CAPS_pubpropertyTestDir

Gets the path to the test directory. Deprecated. Use TestRunDirectory instead.

System_CAPS_pubpropertyTestLogsDir

Gets the path to the test log directory. Deprecated. Use TestRunResultsDirectory instead.

System_CAPS_pubpropertyTestName

Gets the test name.

System_CAPS_pubpropertyTestResultsDirectory

Gets the directory for the test result files.

System_CAPS_pubpropertyTestRunDirectory

Gets the top-level directory for the test run that contains deployed files and result files.

System_CAPS_pubpropertyTestRunResultsDirectory

Gets the top-level directory for the test run result files. This property typically contains a subdirectory of ResultsDirectory.

NameDescription
System_CAPS_pubmethodAddResultFile(String^)

When overridden in a derived class, adds a file name to the list in TestResult.ResultFileNames.

System_CAPS_pubmethodBeginTimer(String^)

When overridden in a derived class, begins a timer with the specified name.

System_CAPS_pubmethodEndTimer(String^)

When overridden in a derived class, ends a timer with the specified name.

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodWriteLine(String^, array<Object^>^)

When overridden in a derived class, used to write trace messages while the test is running.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticAspNetDevelopmentServerPrefix

Represents the prefix for ASP.NET Development Server.

This class cannot be instantiated. Do not create a class that inherits from this class. For more information, see . b41b6c8b-5c47-4445-a73a-1b095c626c93

For an example of how you can use TestContext to create a data-driven unit test, see How To: Create a Data-Driven Unit Test.

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

Return to top
Show: