简体   繁体   中英

Coded UI - Edit uimap.uitest before test run

I have a requirement where I need to change window titles before executing a test case from Coded UI. The window title remains same except that a part of it must be replaced by another string. Eg: [Main Window - abc] need to be updated as [Main Window - xyz].

Currently I have built an app which finds and replaces the text in .uitest files[as .uitest is just an xml.]

Can somebody let me know if there is a way to do it inside my test code itself. Like update the titles and then execute the case. Thank you in advance.

Update this in your constructor:

this.SearchProperties[WinWindow.PropertyNames.Name] = "Main Window - abc";

To this:

this.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.Name, "Main Window", PropertyExpressionOperator.Contains));

Unless you are referring to this line of code that gets inserted if you are using the Coded UI Test Builder to generate your object mappings:

this.WindowTitles.Add("Main Window - abc");

In which case you can just delete that line of code. It is unnecessary and not used in finding window objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM