23Jan
Assertions in Coded UI
Let us discuss how to add assertions in coded UI.
Assertions are checkpoints/benchmarks to UI controls and are used to verify the expected results of UI controls in Coded UI testing.
Following are some of the assertions that are available in Coded UI.
- AreEqual
- AreNotEqual
- Contains
- Matches
- DoesNotMatch
- StartsWith
- EndsWith
- IsNull
- IsNotNull
Assertions are added with the help of Coded UI Test Builder. Open Test Builder, Click on crosshairs icon
or drag the crosshair cursor onto UI control in application which results to be verified.
When clicked on crosshair icon (third button), assertion dialog box will be opened. Click on the left arrow << (Show UI Control Map) to navigate through UI controls.

Select the UI control, properties of UI control will be displayed on right hand side.

Select property and choose Add Assertion.

In dialog box select Comparator, provide Comparison Value and Message on Assertion Failure.

Provide Method name, description for Assertions and generate code. The generated code method will be displayed in Visual Studio Editor.

Build the code once again and Run Tests to verify assertion results.
If the Comparison value doesn’t match with UI control value, assertion failure message will be displayed as test result.
Happy Testing 

Related
Defect is an unexpected behavior of the software application flow against the requirement specificat...
Read More >
IFrame (FullForm: Inline Frame) is an HTML document that is included in another HTML document and is...
Read More >
Synchronization meaning: when two or more components involved to perform any action, we expect these...
Read More >
Wouldn’t it be great if Test Report are sent automatically across team as soon the Test Execut...
Read More >
Reports play a fundamental role when it comes to TESTING. Tester can now know the real-time r...
Read More >
Pre-requisite : Visual Studio Enterprise 2015 application should be installed into the system.Create...
Read More >
Analysis of Performance DataAfter you capture and consolidate your results, analyze the captured dat...
Read More >
While testing a web application it is very important to test the application on different browsers. ...
Read More >
The main difference between Radio button and Checkbox is that, using radio button we will be able to...
Read More >
Share