我在我的应用程序上运行编码的ui测试,我遇到了一个问题:
我想在标签的文本发生变化时断言,但是当这个值发生变化时,我的控制变为空(如果我在更改标签的值之前断言它将被找到并且断言将起作用)。
我的uimap中的相关代码(自动生成):
public void assert_labelA()
{
#region Variable Declarations
WinText uIAText = this.UIQuadraticSolverWindow.UIItem5Window.UIAText;
#endregion
Assert.AreEqual(this.assert_labelAExpectedValues.UIATextDisplayText, uIAText.DisplayText);
}
...
[GeneratedCode("Coded UITest Builder", "10.0.40219.457")]
public class UIItem5Window : WinWindow
{
public UIItem5Window(UITestControl searchLimitContainer) :
base(searchLimitContainer)
{
#region Search Criteria
this.SearchProperties[WinWindow.PropertyNames.ControlName] = "labelA";
this.WindowTitles.Add("Quadratic Solver");
#endregion
}
#region Properties
public WinText UIItem5Text
{
get
{
if ((this.mUIItem5Text == null))
{
this.mUIItem5Text = new WinText(this);
#region Search Criteria
this.mUIItem5Text.SearchProperties[WinText.PropertyNames.Name] = "5";
this.mUIItem5Text.WindowTitles.Add("Quadratic Solver");
#endregion
}
return this.mUIItem5Text;
}
}
public WinText UIAText
{
get
{
if ((this.mUIAText == null))
{
this.mUIAText = new WinText(this);
#region Search Criteria
this.mUIAText.SearchProperties[WinText.PropertyNames.Name] = "A";
this.mUIAText.WindowTitles.Add("Quadratic Solver");
#endregion
}
return this.mUIAText;
}
}
#endregion
#region Fields
private WinText mUIItem5Text;
private WinText mUIAText;
#endregion
}
答案 0 :(得分:0)
这条线造成了问题:
this.mUIItem5Text.SearchProperties[WinText.PropertyNames.Name] = "5";
这是一个多余的标准。