Coded UI Interview Questions

  • (4.0)

Coded UI Interview Questions

If you're looking for Coded UI Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research Coded UI salary ranges from $28,000 to $177,000. So, You still have opportunity to move ahead in your career in Coded UI Engineering. Mindmajix offers Advanced Coded UI Interview Questions 2018 that helps you in cracking your interview & acquire dream career as Coded UI Engineer.

Are you intereted in taking up for Coded UI Certification Training? Enroll for Free Demo on Coded UI Training!


Q: What do you understand by Coded UI?
Automated tests that can drive our software through its user interface (UI) are known as coded UI tests (CUITs). These tests include practical testing of UI controls. They let us confirm that the whole software or application, including its user interface, is performing correctly. Coded UI Tests are mainly useful where there is validation or other logic in the user interface, like in a web page. They are also commonly used to automate existing manual test.  A classic development experience might be one where, we simply build our software or application and click through the UI controls to confirm that things are working properly. We then decide to create a coded test so that we don’t need to continue to test the software or application manually. Depending on the specific functionality being tested in our software or application, we can write code for either a functional test, or for an integration test that may or may not include testing at the UI level. If we only want to directly access some business logics, we might code a unit test. However, under certain situations, it can be beneficial to include testing of various UI controls in our software or application. A coded UI test can automate the scenario, confirming that code churn does not impact the functionality of the software.

Q: What do you mean by Automation Testing?
Automation Testing is a method where a professional writes the scripts using a specific tool and executes the scripts to test the product, Software or application and compare the anticipated results with actual results and collect outcomes to initiate necessary modifications. Tests can be carried out with these tools repeatedly, at any time. 

Q: Why should we go for Coded UI Automation Testing?
For Coded UI we can exercise Visual Studio IDE to write down scripts.
1. Coded UI scripts can be executed through Visual Studio or by through Microsoft Test Manager (MTM).
2. For Coded UI we can write scripts with Visual Studio, and can use all object programming concepts on need.
3. Coded UI supports windows and web applications, WPF, Sharepoint, Client applications and CRM web client applications.
4. Coded UI offers supports any information source managed by the .NET framework. 
5. Coded UI supports file of .csv, .xml or any information sources like SQL server table, access table, etc.

Q: How much percentage of testing will be covered in any case of automation testing?
Following are the prerequisites for automation testing to be implemented:

1. Critical Scenario of the test cases.
2. Repeated test case or not.
3. Time consumption of test cases.
4. Test cases which are difficult to perform manually.

Taking into consideration of the above mentioned conditions, 60-70 % of testing can be covered by automation testing. Moreover, height, width and colors of the controls in application, software or product can’t be tested.

Q: How Many Different types of programming approaches are available in Coded Ui?
Three different types of programming are available in Coded UI.

1. Complete Descriptive Programming.
2. Programming using UI Map.
3. Recording and Playback.

Q: How can controls be recognized in Coded Ui?
There is a specific tool accessible in Coded UI in the name of Test Builder. Within this Test Builder, there is an option named ‘Cross Hair’, with which we can find out the controls and can get the information on properties of the controls.

Q: What do you understand by Test Builder?
Test Builder is a tool accessible in Coded UI, which contains 4 options
>> Record, which is used to record the actions.
>> Show Recorded Steps, which is used to show all of the recorded steps.
>> Cross Hair, which is used to identify the controls and can find out the property information of controls.
>> Generate Code, which is used to generate the code for the recorded actions.

Q: What is the Namespace to work on Coded Ui Controls?
Following are the namespace to work on Coded UI:

1. Using Microsoft.VisualStudio.TestTools.UITesting;
2. Using Microsoft.VisualStudio.TestTools.UnitTesting;
3. Using Microsoft.VisualStudio.TestTools.UITest.Extension.

Q: What is the Namespace to work on the Web Controls?
The namespace to work on Web Controls in Coded UI is Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.

Q: What do you know by TestMethod In Coded UI?
In Coded UI, 1 TestMethod is same as 1 Test case. Every coded UI test is a test method in a coded UI test class. We can add multiple Test methods for each coded UI test class and specify each coded UI TestMethod with the help of  TestMethodAttribute. Test methods can also add validation code for a single UI test control to get the value of a property of a UI test control.

Check Out Coded UI Tutorials

Q: What do you understand by TestInitialize and TestCleanup Coded UI?
TestInitialize and TestCleanup are  attributes which are useful at the time of unit test setup.

TestInitialize - This attribute is required when we prefer to run a function before execution of a test. For example we prefer to run the same test 5 times and prefer to set some property value before running each time. In such cases we can define one function and decorate the function with a TestInitialize attribute.

TestCleanup - This attribute is just the opposite of TestInitialize. Every time the function is decorated with this attribute, it will only execute when test execution finishes. After execution of each and every test if we need to perform some cleanup operation. That time we can write down codes within this function.

Q: What are Attributes in Coded UI? Give some list of Attributes?
[TestMethod] is an attribute before method in class which indicates that the method should be executed to perform a test.
[DataSource(…)] is an attribute which we use for Data Driven Testing.
Similarly, there are many other attributes available in Coded UI:
[TestMethod], [TestCleanup], [TestInitialize], [TestClass] and [AssemblyCleanup]

Q: What is the approach to perform mouse click operation?
Using Click() method we can carry out click operation on any control in Coded UI.

To be precise, there are 10 Click() overload methods which is mentioned below:

1. Mouse.Click();
2. Mouse.Click(ModifierKeys modifierKeys);
3. Mouse.Click(MouseButtons button);
4. Mouse.Click(Point screenCoordinate);
5. Mouse.Click(UITestControl control);
6. Mouse.Click(UITestControl control, ModifierKeys modifierKeys);
7. Mouse.Click(UITestControl control, MouseButtons button);
8. Mouse.Click(UITestControl control, Point relativeCoordinate);
9. Mouse.Click(MouseButtons button, ModifierKeys modifierKeys, Point screenCoordinate);
10. Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate).

Q: What is the Alternative Approach To Perform Click Operations (without
We should move the control on to UI element using Keyboard. SendKeys(“{TAB}”); then use Keyboard.SendKeys(“{ENTER}”); to perform click operation.

Q: What Are Search Properties And Filter Properties?
Search properties are the mandatory properties that is used to search the control, and failing to find a control with the matching search properties will fail the search. However, the filter properties are optional in the case that if a matching control with a given filter properties are not found, then the search may still work using other search or filter properties. In other words, we can visualize search properties with logical "AND" operator and the filter properties with logical "OR".

Q: How Many Ui Maps Can Be Created In Coded Ui?
We can crate Any number of UIMaps in Coded UI.

Q: How To Access The New Ui Map Controls From Another Cs File?
Using Get and Set properties we can access the new UI Map controls in another cs files. Below the sample code.
public UIMap UIMap

Q: What is Assertion and its uses in Coded UI?
An assertion is a true or false statement placed in a program to indicate that the developer thinks that the predicate is always true in that place. If an assertion evaluates to false at run-time, an assertion failure is resulted, which typically causes execution to terminate itself.

Below are some significant classes used in Coded UI:

1. Assert
2. StringAssert
3. AssertFailedException
4. AssertInconclusiveException

Q: Can we write our own custom statement for assertion?
Writing a customized assertion in the middle of the code might find its use. To do so we need to record all the steps down to the point where we want to Assert and generate the code from it. Next we add any type of assertion and generate it. Again, we go step by step with the code that is supposed to follow the assertion. To deal with the custom assertion issue, we go into the code (UIMap) and find the assertion method we have generated. Here we can test any scenario we want.  

Q: How Many Assertions Can Be There in a TestMethod?
There can be any number of Assertions in a TestMethod.

Q: Difference Between Assert.isequal() And Assert.aresame()?
Difference between the two assertions are very easy. Assert.AreSame checks whether they are the exact same object, memory reference and all (in the case of .NET using ReferenceEquals). Assert.AreEqual checks whether objectOne. Equals(objectTwo) will return to true.

Q: What Is Synchronization?
Synchronization makes sure that the speed of automation scripts execution is in sync with application under test (AUT) response/speed. To enable sync,  Coded UI/QTP/.. Uses WAIT statement or Test Settings.

Q: What are the levels of Synchronization Coded UI?
Different levels of Sync:
Test level sync

Default wait time in Coded UI is 60000 milliseconds

Statement level sync in Coded UI

Unconditional wait – Playback Wait
Conditional wait – all other wait statements.

Q: What Are Conditional Statements In Synchronization?
Statements execution depends on some circumstances. In coded UI there are 8 Conditional Statements:

>> WaitForControlReady()
>> WaitForControlEnabled()
>> WaitForControlExist()
>> WaitForControlNotExist()
>> WaitForControlPropertyEqual()
>> WaitForControlPropertyNotEqual()
>> WaitForControlCondition()
>> WaitForCondition()

Q: What Are Unconditional Statements In Synchronization?
Statements executed without any condition. In coded UI there is 1 Unconditional Statement which is Playback.wait().

Q: Explain Waitforcontrolenabled, Waitforcontrolexist And Waitforcontrolready?
This attribute waits for control to be enabled.
WaitForControlExist(): This attribute waits for control to exist on UI.
WaitForControlReady(): This attribute waits for the control to be ready to accept keyboard or mouse input. Coded UI playback engine perfectly calls this API for all actions to wait for the control and to be ready before doing any operation.

Even WaitForControlExist() and WaitForControlEnabled() methods return true WaitForControlReady() may be false because nonsynchronized operations may obstruct the control to be ready to receive any inputs.

Q: Why are we using coordinate based actions in Coded UI Test?
When we record actions & generate code in Coded UI Test, we get actions like Mouse.Click(uISearchButton, new Point(18, 15)); Many users get confused by the Point argument we pass to Mouse.Click and believe that we are doing a coordinate based action. The Point argument here is relative to the button itself. So the test will not fail if the button moves around in the page. More significantly, we can completely remove the Point argument. The code could be written asMouse.Click(uISearchButton); This will still function. If no Point argument is specified, Visual Studio UI Test Framework determines a clickable point and executes the click on that point.

Q: Explain About Data Directory? How can it be created?
Data Directory means Project Directory/Project folder. 

Following are the steps to create one:-

** Step 1 - Create a coded UI test. Create a project. ...
** Step 2 - Create a data set. Add a text file to the dataDrivenSample project named data.csv . ...
** Step 3 – Add data source binding. ...
** Step 4 – Use the data in the coded UI test. ...
** Step 5 – Run the data-driven test.

Q: How Many Types Of Ddt Available On Coded Ui?
Data Driven Test can be performed in Coded UI using 5 Data Source types:

1. Using CSV 
2. Using XML
3. Using Excel
4. Using SQL 
5. Using Test case in TFS

Q: What Are The 4 Major Steps In Ddt?
Below are the 4 major steps for DDT in Coded UI:
1.Prepare the test data.

a. If running on CSV/XML/EXCEL, build a respective file and add the test data.
b. If running on SQL/TFS directly add the test data to respective table or test case.

2.Add Data Source Attribute.
3.Get test data from file and map to the respective control.
4. Right click on file, go to properties and change the Copy to Output Directory value to ‘Copy always’.


Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules