Share via


How to: Edit Control Properties Using the Coded UI Test Editor

By using the Coded UI Test Editor, you can open a coded UI test for editing and modify the properties for specific controls.

Opening a Coded UI Test in the Coded UI Test Editor

Follow these steps to open an existing coded UI test for editing in the Coded UI Test Editor.

To open a coded UI test in the Coded UI Test Editor

  1. In Solution Explorer, locate UIMap.uitest in your test project.

  2. Right-click UIMap.uitest and select Open.

    -or-

    Double-click UIMap.uitest.

    The coded UI test is displayed in the Coded UI Test Editor. You can now view and edit the coded UI test. For more information, see Editing Coded UI Tests Using the Coded UI Test Editor and How to: Edit a Coded UI Test Using the Coded UI Test Editor.

Editing Control Properties in the Coded UI Test Editor

Follow these steps to edit the properties for the controls that are used in your coded UI tests.

Control properties

To edit control properties

  1. In the UI Control Map pane, select the control that you want to edit.

    Tip

    Sometimes, it can be difficult to visualize where controls are located in the UI of the application under test. One of the capabilities of the coded UI Test Editor is that you can select a control listed in the UI control map and view its location in the application under test. For more information, see How to: Locate a Control in the Application under Test Using the Coded UI Test Editor.

    Note

    It might be necessary to expand the container control that contains the control that you want to edit. For more information, see How to: Locate All Descendants of a Container Control Using the Coded UI Test Editor.

    Tip

    When you select a UI action that is located in a method in the UI Actions pane, the corresponding control is highlighted.

  2. If the Properties window is not displayed, press F4. In the Properties window, change the value for the property you want to change.

    For example, a developer might have changed the (ID) property on a button control in the source code for the application being tested from “idSubmit” to “idLogin.” With the (ID) property changed in the application, the coded UI test will not be able to locate the button control and will fail. In this case, the tester can open the Search Properties collection and change the Id property to match the new value that the developer used in the application. The tester could also change the Friendly Name property value from “Submit” to “Login.” By making this change, the associated UI action in the Coded UI Test Editor is updated from “Click ‘Submit’ button” to “Click ‘Login’ button.”

    Tip

    You can verify search property changes that you made to a control using Locate the UI Control. For more information, see How to: Locate a Control in the Application under Test Using the Coded UI Test Editor.

    Tip

    You can use the Find button in the Coded UI Test editor toolbar to open the Find and Replace tool in Visual Studio. You can then use the Find control to locate a UI action in the Coded UI Test editor. For example, you can try to find “Click ‘Login’ button.” This can be useful in large tests. Note that you cannot use the replace functionality in the Find and Replace tool in the Coded UI Test Editor. For more information, see Find control in Finding and Replacing.

    Tip

    You can undo the property changes you made. Choose Undo from the Edit menu, or press Ctrl+Z.

  3. On the Visual Studio toolbar, click Save.

    The updates to the test method are saved in the UIMap.Designer file.

See Also

Tasks

How to: Edit UI Action Properties Using the Coded UI Test Editor

Other Resources

Editing Coded UI Tests Using the Coded UI Test Editor