This documentation is archived and is not being maintained.

WebTest.Outcome Property

Gets or sets the Pass or Fail outcome of the Web test.

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

public Outcome Outcome { get; set; }

Property Value

Type: Microsoft.VisualStudio.TestTools.WebTesting.Outcome
The outcome of the Web test.

The primary reason to set WebTest.Outcome is to ignore an expected failure so that the WebTest is marked as Passed despite the expected failure.

Because the Web test runtime engine also sets the Outcome property of WebTest, the final value of the Outcome property might not be the same as the value that your code sets.

If you set the value of WebTest.Outcome to Fail, the Web test runtime engine will not override that setting, and the Web test will be marked as Failed when it completes. However, if you set WebTest.Outcome to Pass in the middle of a Web test, before all Web test requests have been issued and validation rules have been invoked, the Web test runtime engine overrides the value and sets WebTest.Outcome to Fail if there is an error after you set the value to Pass.

To guarantee that the final value for WebTest.Outcome is Pass, set it in the PostWebTest event handler.