IamP
IamP

Reputation: 126

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.

Upvotes: 0

Views: 78

Answers (1)

jibbs
jibbs

Reputation: 762

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.

Upvotes: 2

Related Questions