Thursday, January 2, 2014
CodedUI test - check for existence of dialog
If the application has a dialog that is only displayed in certain cases you can write a custom method to execute commands when the dialog exists. This application has a dialog that is only displayed if an add-in could not be loaded.
Execute certain commands when dialog exists:
1. Record the assertion and action on the dialog.
2. Write a new method in UIMap.cs to check for existence of the dialog and execute the recorded assertion and the recorded action.
3. Move calls to the recorded assertion and recorded action from CodedUITest.cs to new method in UIMap.cs.
if (dialog.Exists)
{
AssertDialogRecorded();
DialogActionRecorded();
}
4. Add a using statement to UIMap.cs for Microsoft.VisualStudio.TestTools.UITesting.WinControls:
5. Call the custom method from CodedUITest.cs in place of the recorded assertion and the recorded method.
this.UIMap.ClickOKIfDialogExists();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment