TestContext Class

Definition

Used to store information that is provided to unit tests.

public ref class TestContext abstract
public abstract class TestContext
type TestContext = class
Public MustInherit Class TestContext
Inheritance
TestContext

Constructors

TestContext()

Fields

AspNetDevelopmentServerPrefix

Properties

CancellationTokenSource

Gets or sets the cancellation token source. This token source is canceled when test times out. Also when explicitly canceled the test will be aborted

CurrentTestOutcome

Gets the current test outcome.

DataConnection

Gets current data connection row when test is used for data driven testing.

DataRow

Gets the current data row when test is used for data driven testing.

DeploymentDirectory

Gets directory for files deployed for the test run. Typically a subdirectory of TestRunDirectory.

FullyQualifiedTestClassName

Gets the Fully-qualified name of the class containing the test method currently being executed

ManagedMethod

Gets the fully specified method name metadata format.

ManagedType

Gets the fully specified type name metadata format.

Properties

Gets test properties for a test.

RequestedPage
ResultsDirectory

Gets base directory for results from the test run. Typically a subdirectory of TestRunDirectory.

TestDeploymentDir

Gets directory for files deployed for the test run. Typically a subdirectory of TestRunDirectory. Same as DeploymentDirectory. Use that property instead.

TestDir

Gets base directory for the test run, under which deployed files and result files are stored. Same as TestRunDirectory. Use that property instead.

TestLogsDir

Gets directory for test run result files. Typically a subdirectory of ResultsDirectory. Same as TestRunResultsDirectory. Use that property for test run result files, or TestResultsDirectory for test-specific result files instead.

TestName

Gets the name of the test method currently being executed

TestResultsDirectory

Gets directory for test result files.

TestRunDirectory

Gets base directory for the test run, under which deployed files and result files are stored.

TestRunResultsDirectory

Gets directory for test run result files. Typically a subdirectory of ResultsDirectory.

Methods

AddResultFile(String)

Adds a file name to the list in TestResult.ResultFileNames

BeginTimer(String)

Begins a timer with the specified name

EndTimer(String)

Ends a timer with the specified name

Write()

Used to write trace messages while the test is running

Write()

Used to write trace messages while the test is running

WriteLine()

Used to write trace messages while the test is running

WriteLine(String, Object[])

Used to write trace messages while the test is running

Applies to