当我录制“登录方案”的测试方法与编码的UI测试,它会产生这样的当我在编码的UI测试更新的UIMap中,UIMap.Designer.cs文件覆盖在我的代码
生成的代码代码
public void LoginMethod()
{
#region Variable Declarations
WinEdit uIItemEdit = this.UIDiagnosoftVIRTUEWindow.UIItemWindow.UIItemEdit;
WinEdit uIItemEdit1 = this.UIDiagnosoftVIRTUEWindow.UIItemWindow1.UIItemEdit;
WinComboBox uIItemComboBox = this.UIDiagnosoftVIRTUEWindow.UIItemWindow2.UIItemComboBox;
WinButton uIConnectButton = this.UIDiagnosoftVIRTUEWindow.UIConnectWindow.UIConnectButton;
#endregion
// Type 'username' in 'Unknown Name' text box
uIItemEdit.Text = this.LoginMethodParams.UIItemEditText;
// Type '********' in 'Unknown Name' text box
Keyboard.SendKeys(uIItemEdit1, this.LoginMethodParams.UIItemEditSendKeys1, true);
// Select 'facility' in 'Unknown Name' combo box
uIItemComboBox.SelectedItem = this.LoginMethodParams.UIItemComboBoxSelectedItem;
// Click 'Connect' button
Mouse.Click(uIConnectButton, new Point(64, 14));
}
我更新此代码,让数据驱动源,CSV文件,其中包含用户名,密码,.... 这里是更新的代码
有限公司更新德
public void LoginMethod(string username,string password,string facility)
{
#region Variable Declarations
WinEdit uIItemEdit = this.UIDiagnosoftVIRTUEWindow.UIItemWindow.UIItemEdit;
WinEdit uIItemEdit1 = this.UIDiagnosoftVIRTUEWindow.UIItemWindow1.UIItemEdit;
WinComboBox uIItemComboBox = this.UIDiagnosoftVIRTUEWindow.UIItemWindow2.UIItemComboBox;
WinButton uIConnectButton = this.UIDiagnosoftVIRTUEWindow.UIConnectWindow.UIConnectButton;
#endregion
// Type 'msameeh' in 'Unknown Name' text box
uIItemEdit.Text = username;
// Type '{Tab}' in 'Unknown Name' text box
uIItemEdit.Text=password;
// Select 'diagnosoft.com' in 'Unknown Name' combo box
uIItemComboBox.SelectedItem = facility;
// Click 'Connect' button
Mouse.Click(uIConnectButton, new Point(64, 14));
}
,我跑的测试方法和它运作良好,但是,当我编辑的UIMap添加未使用的控件,如“Canncel按钮”或任何其他控件 想在这个环节
http://blogs.microsoft.co.il/blogs/shair/archive/2010/08/08/coded-ui-test-tip-4-add-unused-controls-to-ui-map.aspx 的的UIMap了.Designer.cs文件覆盖我的登录方法提前
更新代码与 Genereated代码谢谢
我发现复制的方法形成UIMap.Designer.cs到UIMap.cs一个简单的解决方案 1-功能PACK2必须安装方法要更新 2-开放UIMap.uitest 3-把点击它行为并选择“移动代码” 结果: 方法将从UIMap.Designer.cs移动到UIMap.cs – 2012-08-07 03:44:43