How to create dictionaries to add UI Controls

Author: Alfonso Alarcón

In Coded UI projects of visual Studio (Enterprise, Ultimate or Premium versions) control data (properties and values)  on the different functionalities are saved in structures named UI Controls. Even though other possibilities are possible the UI Controls can be stored in dictionaries to be invoked in functional methods. The important point is to create a dictionary for each type of control. Therefore, it can be a dictionary for: ComboBox, MenuBar, TableGrid, WinButton or WinEdit but the list can be more extends depending of the application. The “Key” of the dictionary is a constant string and the “Value” is the type of the UI Control.

All types of UI Controls are inheritance of the class UITestControl. Therefore, it is possible to create the dictionaries with this class but if you need specific methods of a particular UI Control you must work with its class. For example, in the case of combo boxes, you need to work with the specific methods of the class WinComboBox. In this dictionary all UI Controls are stored in a dictionary named ComboBoxDict inside the method UiTestComboBox():

public static class UIDict
	public static Dictionary<string, WinEdit> UiDictA()
		UIMap uiMap = new UIMap();
		Dictionary<string, WinEdit> winEditDict = new Dictionary<string, WinEdit>();
		return winEditDict;        

More information related with this post in:




Why automated testing?

Author: Alfonso Alarcón

Automated testing is a process to test the functionalities of a software (application, web, mobile,…) taking the role of an end-user to identify any unexpected behavior or bug.  In this way of working the tester writes scripts and uses specialized software such as Visual Studio, HP UFT, Ranorex Studio, SeeTest, Squish or Selenium among others. It is used to re-run test scenarios that were performed manually, more quickly and repeatedly. Automated testing should be used by considering the following aspects:

  • Large and critical projects
  • Projects that require testing the same areas frequently
  • Requirements that do not change frequently
  • Availability of time

Automated testing provides the next benefits:

  • Best Efficiency
  • Reduce task cost
  • Consistency of test execution
  • Reducing cycle time of regression test cycles
  • Repeatability
  • Coverage
  • Reliability
  • Reusability of test products
  • The created scripts can be launched outside office hours extending the time dedicated to test

It is important to mention that is not possible to automate everything in software, web or mobile, and this is a recurrent misunderstanding. There are areas that could not be automated such as those where are required the manual operation in some part of testing. Of course, in some cases, it is possible semi-automate a part of the software coupling manual and automated testing. Besides, it is not recommendable to provide automated testing in areas where the time of implementation is too large making on this manner the automation not viable.