The fifth article from the Design & Architecture Series is going to be dedicated to the creation of Hybrid Test Framework Controls and their T﻿﻿e﻿﻿sting Framework's implementation. First, I am going to guide you through the process of writing a concrete implementation of the abstract controls' interfaces. After that, you will see a fully working test example.

Hybrid Test Framework Controls- Testing Framework Implementation Updated Element

I made a slight change in the class- it is now generic. When you derive it, you should specify the exact type of the Testing Framework's control that it will wrap so that it can be converted successfully. Updated ContentElement

I made the same change for the ContetElement class. Additionally, I moved the IsEnabled property and the Focus method to this base class because they should be available for all content elements. I change the IContentElement interface as well. Anchor

The Anchor class inherits from the ContentElement base class. As pointed above we need to specify the actual type of the wrapped Testing Framework element, in this case, HtmlAnchor. Another difference compared to the WebDriver's implementation of the controls is that the Href of the element should be decoded because it is not by default. Checkbox

We can use the Checked property of the HtmlInputCheckbox class to find out if the checkbox is checked. To check or uncheck the item we just use the Testing Framework's native Check method. ComboBox

Through the SelectedValue property, you can get the currently selected value of the combo box. As you can see from the code above, I used a JavaScript code to select a particular element. You can use the native Testing Framework's method, but it is a little bit slower. TextBox

It is straightforward to get the text of a text box using Testing Framework. You can use the HtmlInputText control's Text property. The same property can be used to type a text. To simulate real typing the TypeText method of the KeyBoard class is called. Div

The Div element is nothing more than a content element. However, to be able to use it in a hybrid manner we need to have a separate class. KendoGrid

Sometimes there are more complex controls such as the ﻿K﻿endo Grid. You can read a lot more in my dedicated article- Automate Telerik Kendo Grid with WebDriver and JavaScript. Test Framework Driver Controls in Test PageObject

This is actually the same page that I used in the test examples for the Selenium Driver controls' implementation. We are going to use the same pages and pages' maps. The only thing that we are going to change is the implementation of the IElementFinder and INavigationService interfaces. Page Object Map

To run the tests with Testing Framework, you don't need to create a separate page or page map. The beauty of the hybrid test framework is that we can reuse their code. Page Object Asserter

Test Example