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 1 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. 

2

 

 

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

3

 

Select property and choose Add Assertion.

4

 

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

5

 

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

6

 

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 7

 

8

 

 

  

Related

What is Defect? Defect Life Cycle in Software Testing.

Defect is an unexpected behavior of the software application flow against the requirement specificat...

Read More >

What are Frames? How to handle frames in Selenium WebDriver with C#?

IFrame (FullForm: Inline Frame) is an HTML document that is included in another HTML document and is...

Read More >

What is Synchronization? Handling Synchronization in Selenium WebDriver using C#:

Synchronization meaning: when two or more components involved to perform any action, we expect these...

Read More >

Sending Test reports by Email using Office 365, Gmail

Wouldn’t it be great if Test Report are sent automatically across team as soon the Test Execut...

Read More >

Extent Reports in Selenium CSharp (C#)

Reports play a fundamental role when it comes to TESTING. Tester can now  know the real-time r...

Read More >

How to Set Up Selenium WebDriver in Visual Studio Enterprise 2015?

Pre-requisite : Visual Studio Enterprise 2015 application should be installed into the system.Create...

Read More >

Analysis of Load Test Results

Analysis of Performance DataAfter you capture and consolidate your results, analyze the captured dat...

Read More >

Parallel Execution using Selenium Webdriver and TestNG

While testing a web application it is very important to test the application on different browsers. ...

Read More >

Handling Radio buttons and Checkboxes using Selenium Webdriver

The main difference between Radio button and Checkbox is that, using radio button we will be able to...

Read More >

Share

Post a Comment

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Contact Us
  • *
  • *