Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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)
Syntax
'Declaration
Public Enumeration UnitTestOutcome
public enum UnitTestOutcome
public enum class UnitTestOutcome
type UnitTestOutcome
public enum UnitTestOutcome
Members
Member name | Description | |
---|---|---|
Failed | The test failed. | |
Inconclusive | An Assert.Inconclusive was raised. | |
Passed | The test passed. | |
InProgress | The test is currently running. | |
Error | ||
Timeout | ||
Aborted | ||
Unknown | The outcome of the test is unknown. |
Remarks
The members of this class contain a subset of all the possible test outcomes. For more information, see Basic Test Results.
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.
Examples
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.