Record and playback
Coded UI Hand codingCoded UI record and playback feature is much like the feature available in popular testing tools like QTP, Test Complete and SoapUI, where Coded UI records all the user actions via Coded UI Test Builder.
Coded UI Test Builder
Coded UI Test Builder is the recording option which is found in other testing tools like QTP and Test Complete as well. It will have a
- Record Button – To start recording the test
- Cross hair option – To get the identification property of the pointed object (like Object Spy)
- Generate Script – This option will generate the script
- Insert Assertion – This option will let us to insert assertion for a particular control
- Show Recorded Steps – This option will show the complete recorded steps
All the recorded actions are stored in a separate class file called UIMap in the project.
So what is UIMAP?UIMap is more like an Object Repository in QTP and Name Mapping in Test Complete were UIMap stores all the objects of Application Under Test (AUT) as a class file. The UIMap looks something like this
UIMap will have hierarchy of the controls identified, this will be helpful to locate each and every controls and their parent child relationship. We can also locate the element from UIMap to actual UI of AUT as shown below
Deep Dive into UIMapUIMap actually has two classes as shown below
These two classes are auto-generated and modification to UIMap.Designer.cs file will revert back once you do a new recording using coded UI Test Builder. This you can see in the file instruction itself, but user has the leverage to change the UIMap.cs file and work with the objects and properties from UIMap.Designer.cs file.
Technically these two classes are partial class files and are pretty much dependent.
How to Execute the Code?So how to finally execute the recorded code?
Option 1Well, just go to your CodedUITest.cs class file which you have created and right click the test method and click Run Test option as shown below
Option 2You can also run your test using Test Explorer, which can be found from Test à Window à Test Explorer
That’s all guys, this way we can perform record and playback using Coded UI testing in Visual Studio 2013. Please leave your comments and thanks for watching the video and reading the article !!! Thanks, Karthik KK