Coded UI Automation Testing Walkthrough : Generated Code Analysis In CodedUiTest Class

This is now the look and feel of how the code for the Recorded Steps is organized under the TestProject. It is all a part of the added item namely CodedUiTest class under the default method name which is TestMethod1. Herein we will now analyze the control flow from this very class to the actual location of the Scripts recorded. The codes are actually present in another file called UIMap.Designer.cs wherein the definiton of the two function calls made from this class file is present. In this class two function calls are present , the ones we created during record time if you can remember from my earlier posts : LogIntoGmail, & ValiateLoginDetails.
 The first one has in it the recorded steps to loginto gmail account and the second one is the validation that the user logged into the account is as per the expected one.  Now when we want to look into the actual scripts during the record time, we can go into the UIMap.designer.cs file and visualize each and every event that occured while recording as is shown in below screenshots.


Some Related posts on Coded UI Testing using VSTS :

 



Well if you open the same file, it is pretty complex to figure out the definition for this very method name, but we can navigate to the same by a shortcut as is exemplified below, by right clicking and clicking go into definiton. In the following screenshots we have tried to use the genuine feature of OOPS programming, yeah non other than Polymorphism to override the values recorded during the Recording, Here what we have overridden is the username and password. We have just copied the code from designer file and pasted prior to the function call in the CodedUITest class file under the method name that is the scenario in an automated looks.Just copy the right side content value and paste it into this file and donot forget to add Uimap just after the this. field. So the code would look like this.UiMap.() , and so on. From hereon we will concentrate on customizing the codes generated during scripting via recording. For the first case that is username field we have no issues , but the second field is a password field and hence needs to be encrypted prior to script execution henceforth the this.uimap.() content is kept under PLayback.Encrypttext so that the password text is encoded before being put into the execution mode. By this we have started the most desired of all automation feature Data Independence of code execution but we have not externalized the data source yet and we shall be doing the same in our next post very soon. Do have a look through the below screenshots.

0 comments:

Post a Comment