Warning: fopen(/tmp/SghXTngBZPli-T6cD1B.tmp): failed to open stream: Disk quota exceeded in /home/executea/public_html/blog/wp-admin/includes/class-wp-filesystem-ftpext.php on line 139
Warning: unlink(/tmp/SghXTngBZPli-T6cD1B.tmp): No such file or directory in /home/executea/public_html/blog/wp-admin/includes/class-wp-filesystem-ftpext.php on line 142
Understanding Why and How Parent-Child relationship works in Coded UI Testing
In the last post, we discussed hand coding web application in coded UI testing and also we faced problem while trying to identify controls of next page (which was User Form Page)
The problem was, every time while identifying a control from next page, we were needed to re-identify BrowserWindow and HtmlDocument as the parent of the control within the page, hence, the hierarchy for identifying any given control was this
Figure 1: Parent-Child Relationship
We can also view the same relation in UIMap.Uitest window, which looks something like this
Figure 2: UIMap.Uitest of Visual Studio
Why do we need relationship?
Before answering this question, let’s take our most popular browser automation testing tool Selenium.
Let’s examine the code snippet below
Figure 3: Selenium Code Snippet (JAVA)
The above code snippet leaves us with following questions
Where is the relationship of controls maintained?
How does Selenium manage to identify the controls?
As shown in the code snippet, we are first creating the instance for WebDriver and then using this instance, we are finding all the controls, thus, the in selenium the relationship for identify each and every controls are by default maintained using the instance of Web Driver.
Needless of where the browser takes the page, the web driver has the handle for every controls, hence there require no relationship.
Here is the complete video of the above post
Thanks for reading the post and watching the video !!!
Please leave your comments and let me know if there is anything I need to improve in the post and video !!!
Thanks,
Karthik KK
Post Author:
Karthik kk
20 Replies to “Understanding Why and How Parent-Child relationship works in Coded UI Testing”
I am a regular reader of your blog which helping to learn Codedui in simple way.
It would be really helpful for beginner if you share sample codedui project with framework.
while creating the build in VSTS 2013, I am getting the fllowing issue.
please suggest me how to slove this issue
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (32561): Type ‘HtmlDocument’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34428): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34426): Type ‘HtmlHyperlink’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34422): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34418): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34416): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34412): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34408): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34404): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34400): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34394): Type ‘HtmlDiv’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34392): Type ‘HtmlEdit’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34390): Type ‘HtmlComboBox’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34388): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34384): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34382): Type ‘HtmlDiv’ is not defined.
I suspect the problem is somewhere in the way you are accessing the static property, if your accessing method as access specifier as static, then you will not have this problem.
Hi Karthik,
Thanks for free knowledge transfer through videos.
I have below problem:
1) In 15th video, you used as public static void CustomWebMethod() and in 16th video it is showing directly as public void CustomWebMethod.
2) Because of removing static, i am unable to call this class in CodedUITestMethod1 because it is not static.
Please let me know how can i overcome this problem.
I am undergoing the videos of all about codedUI, It was great and much appreciated. After studying these I gained my confidence level in coded ui. However, I am going to complete all videos in another 2 o 3 days, so do we expect any more videos on coded ui apart from this in future?
Do you have the finished code for the CustomCaller.cs in this vid? I’m having trouble finding out what is wrong with my test. I keep getting “An object reference is required for the non-static field, method, or property ‘CustomCaller.CustomWebMethod()’ and my test is underlined in red. What kinds of things should i be looking for to fix this?
Hi Karthik,
In this vedio series you have explained ablout the parent child relationship for web. How about the Windows appliction. I have tried similar with the windows but currentwindow is not working the windows application.
I am a regular reader of your blog which helping to learn Codedui in simple way.
It would be really helpful for beginner if you share sample codedui project with framework.
Sure, I am planning to release as many as in Github.
Thanks,
Karthik KK
HI Karthik ,Have you posted the codedui sample project with framework in Github?
It will be very useful to learn.
Thank you,
while creating the build in VSTS 2013, I am getting the fllowing issue.
please suggest me how to slove this issue
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (32561): Type ‘HtmlDocument’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34428): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34426): Type ‘HtmlHyperlink’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34422): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34418): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34416): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34412): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34408): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34404): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34400): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34394): Type ‘HtmlDiv’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34392): Type ‘HtmlEdit’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34390): Type ‘HtmlComboBox’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34388): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34384): Type ‘HtmlInputButton’ is not defined.
C:\Builds\1\SHFL\shfl\src\SHFL complete testcase process\UIMap.Designer.vb (34382): Type ‘HtmlDiv’ is not defined.
Thanks in Advance.
Seems like reference to HtmlControl class is missing and hence its throwing this error.
Can you check reference to the project as well as the DLL which is referencing it.
Thanks,
Karthik KK
Hello Kartik,
Thank you for the videos.
I am getting error , when i tried to implement the section that is in the above video.
Error 4 An object reference is required for the non-static field, method, or property ‘IMTtestCode.Testclass.parentwindow.get’
Thanks,
Bina
I suspect the problem is somewhere in the way you are accessing the static property, if your accessing method as access specifier as static, then you will not have this problem.
Please let me know if you have same problem
Thanks,
Karthik KK
Hi Karthik,
Thanks for free knowledge transfer through videos.
I have below problem:
1) In 15th video, you used as public static void CustomWebMethod() and in 16th video it is showing directly as public void CustomWebMethod.
2) Because of removing static, i am unable to call this class in CodedUITestMethod1 because it is not static.
Please let me know how can i overcome this problem.
Hi Karthik,
I see above same problem which mention Jagan Nimma. Please let me know how can i solve this error.
Yes, for this you need to create an instance to call the method.
Hi Karthik,
How can create an instance and what type of instance i create in customWebMethod. Can you explain all the steps.
I can solve this problem creating the new instance CustomCaller c = new CustomCaller();
Nice Video KK
Hi Karthik,
I am undergoing the videos of all about codedUI, It was great and much appreciated. After studying these I gained my confidence level in coded ui. However, I am going to complete all videos in another 2 o 3 days, so do we expect any more videos on coded ui apart from this in future?
Thanks,
Shiva
Hopefully yes, but will take some time.
But soon you will see video on CUIT with ALM.
Thanks,
Karthik KK
Hey Karthik,
Do you have the finished code for the CustomCaller.cs in this vid? I’m having trouble finding out what is wrong with my test. I keep getting “An object reference is required for the non-static field, method, or property ‘CustomCaller.CustomWebMethod()’ and my test is underlined in red. What kinds of things should i be looking for to fix this?
how to get the controlid in Uicoded Test Bulider
How to find controls which are having the similar property(automationId, name) value?
Same Question from my side as well
Hi Karthik,
In this vedio series you have explained ablout the parent child relationship for web. How about the Windows appliction. I have tried similar with the windows but currentwindow is not working the windows application.