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.

UnitTestOutcome Enumeration

 

Use UnitTestOutcome to programmatically determine the outcome of a test that has run or is currently running.

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

public enum class UnitTestOutcome

Member nameDescription
Aborted

Error

Failed

The test failed.

Inconclusive

An Assert.Inconclusive was raised.

InProgress

The test is currently running.

Passed

The test passed.

Timeout

Unknown

The outcome of the test is unknown.

The members of this class contain a subset of all the possible test outcomes. For more information, see .d65bf775-0480-473a-aa0c-92d34370a831

You can refer to this class, for example, from a test method or a test-cleanup method that follows a unit test.

The UnitTestOutcome is passed in the TestContext.

Legacy Code Example

You could compare TestContext.Outcome with UnitTestOutcome.Failed to determine the result of a specific test, and then take appropriate action, such as deleting certain files from the hard disk.

Return to top
Show: