Coded UI Automation Testing Walkthrough : Code Customization from Partial Class UiMap.cs

Now let us bring Code Customization to a higher level. If we can scroll down into the CodedUITest Calls file , then at the bottom of the page we can see a section of code relating to the term TestContext.  Do  keep in track that this very class is the base of all testing methods that are incorporated and brought to use by the Automation Namespace and methods in the complete CodedUi Automation Testing.

Some Related posts on Coded UI Testing using VSTS :

 


The TestContext is something that we will be bringing to an optimum use in our case when we will externalise our data from some sheet and also use a separate class file for code customization to bring in the Reusability feature in our Project.

Here in the code below we can see one more class file Namely UiMap.cs. This is another partial class file wherein we can use some code customization to bring in a sense of high degree of reusability. Here create one function under the partial class file as is shown under, with one parameter being passed  to it which is nothing but the TestContext instance  to which the current script relates to. The same can be seen in further screenshots. SO we have come to this new class file and from here on we shall be using this class file to create all custmized function calls. Hence now the Workflow will be CodedUiTest file -> Uimap.cs-> UiMap.designer.cs file.


 




In the second last screenshot we have introduced a New view namely the Test View , which is where from we run the Coded Ui Test methods,  All the methods are listed in this very View, Infact all the Methods can be organised at the overall level and the Namesapce level. This is how we have got the Test View, which needs to be refreshed at every Debug or run event. The updates made can be run only after refresh has been applied to the codes. So now we will be accessing all the methods from the TestView only.

2 comments:

  1. Hi,
    I have started created coded ui scripts on large application(20 pages need to fill for one case) , i'm middle of the scripts and i unable to param custom drop-down box

    Please help me on this regards.

    ReplyDelete
  2. uitestcontrol is the base class just create an instance of the same and use the display text, or inner text as the search properties.
    I hope that helps the control recognition.

    ReplyDelete