简体   繁体   English

编码的用户界面-在测试运行前编辑uimap.uitest

[英]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. 我有一个要求,在从编码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]. 例如:[主窗口-abc]需要更新为[主窗口-xyz]。

Currently I have built an app which finds and replaces the text in .uitest files[as .uitest is just an xml.] 目前,我已经构建了一个应用程序,该应用程序可以查找并替换.uitest文件中的文本(因为.uitest只是一个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: 除非您使用的是编码UI测试生成器来生成对象映射,否则除非您引用插入的这一行代码:

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. 这是不必要的,并且不用于查找窗口对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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