编码的UI测试在不断变化的Control Map ID上添加断言 [英] Coded UI Testing Adding assertions on to Control Map ID's that keep changing

查看:150
本文介绍了编码的UI测试在不断变化的Control Map ID上添加断言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

希望有人可以帮助我,我正在尝试在应用程序上添加一个断言.

Hope someone out there can help me, I am trying to add an assertion on an application.

我正在使用Visual Studios 2013编码UI测试,使用UIMap-编码UI测试生成器

I am using Visual Studios 2013, Coded UI test, using the UIMap - Coded UI Test Builder

我已将十字准线用于断言,并且已经选择了相关的区域".我要添加的应用程序.

I have used the crosshair for the assertion, and I have selected the relevant "area" of the application that I want to add. 

此区域"是具有与其关联的ID的数据记录.多次测试时,此ID会更改,并且永远不会相同.

This "area" is a record of data that has an ID associated with it. When testing multiple times this ID will change and never be the same.

不幸的是,链接到该区域"的控件UI映射被添加到该区域".标题带有关联的ID.

Unfortunately the Control UI Map linked to this "area" is titled to the associated ID. 

因此,如果我向其添加一个断言,然后运行新的测试,则ID将更改,并且此验证失败,因为它找不到控件映射.

So If I add an assertion to this and then run a new test, the ID will change and this validation fails because it cannot find the control map. 

有什么办法解决吗?我正在尝试验证该数据记录中的数据集,而不是ID.数据将始终位于屏幕的同一区域,因此想知道是否存在一种可以验证应用程序区域的方法?

Is there any way round this? I am trying to validate the set of data that is in that record of data, but never the ID. The data will always be in the same area of the screen so wondered if there was a way it could validate an area of the application? 

我很新,但是会尽力回答任何问题以澄清问题,但是任何帮助将不胜感激.

I am quite new but will try my best to answer any questions to clarify, but any help would be greatly appreciated. 

谢谢

Ryan

推荐答案

Ryan,

根据您的描述,您想要操作具有更改ID的控件.我认为您不能使用UIMap调用此控件.您必须使用 基于其他属性(ID属性除外)的处理代码.

According to your description, you want to operate a control with changing ID. I think you cannot call this control with UIMap. You must get this control with handing code based on other properties (except ID property).

因此,我们需要一个条件,即必须具有其他属性才能识别控件.即使ID属性一直在变化.

So we need a condition that with other properties we must be able identify the control. Even though ID property changing all the time.

如果我们无法使用其他属性获取此控件,则可以获取UITestControl集合,然后可以使用其他指定属性来获取正确的控件.即使ID有所更改,并且该ID是否具有范围,如果可以,我认为我们可以 用这个.

If we could not get this control with other properties, wo could get a UITestControl collection, then we could use other specify property to get a correct control. Even though the ID is changing, and whether this ID has a range, if yes, I think we could use this.

以上是我的看法,但是我不知道您正在测试哪个项目,Web,Winform或WPF?如果您可以分享给我一个示例,我会尽力帮助您编写此代码.

Above is my opinion, but I do not know which project you are testing, web, winform or wpf? If you could share me a sample, I will try my best to help you hand code this.

此致

奥斯卡


这篇关于编码的UI测试在不断变化的Control Map ID上添加断言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆