UiMap.cs File In Coded Ui Testing In VSTS

UiMap.cs File In Coded Ui Testing In VSTS
What is : UiMap.cs file is a partial class file in the Coded UI Testing approach used in the VSTS.

The general perception that a Automation Testing concept involves is the possibility of incorporating a framework approach on the top of any automation tool. This very class file which is a partial class file can be used to serve the same purpose in VSTS Automation Testing.

This is the one single place wherein  we can build the utility functions that can be used across the application by the Automation Test Class files : which are none other than the Coded UI Class files. Also from here we can even override the properties of the objects available in the application  as per the recorded scripts. At times we even refer the UIMap.cs files as the extensions for the uimap.designer.cs files. The only difference between the two being the Former one is editable while the latter is not editable at all. The latter one's editable fetaure is availed by overriding the objects porperties.

Partial class files are in genuine a file which has some reusable code blocks that act as a continuance to some other class files. In our case it is the designer file that is the class file and the uimap.cs file is the continuance to it. Generally some very raw features such as  a link click or a URL load, or some other sceraios where in the Robustness of a Uimap.Cs partial class file can be brought to use is when we have multiple types of users who can log into an application and it is the role based authorization that is provided after having been authenticated to be a valid user in the application, we bring this very partial class to an optimum use.

We may record a scenario for the features of an application wherein the access to various sub - features may be on the basis of  roles provided , so by the usage of some Switch case from within the partial class files, we can attain the flexibility of code once reuse everywhere.

A small code to simulate the behavior is shown for reference to illustrate the usage of the UImap.cs partial class file:

By this block of code what we can do is call the login function with Two parameters, one being the Testcontext and the other one being the Role. depending on the role the specific authorized user can log inot the application. We have genuinely considered some eight sets of users, however  any programmar can guess that it remains a valid intelligence to use it as per our requirements.

Do have a look at the code below :


Post a Comment