我目前正在评估White测试框架。非常棒的东西!
一切看起来都很有希望,但我遇到了一堵小墙。
如何测试.NET 2.0 PictureBox?
没有预先确定的UIItem。虽然有Image类,但我如何将它与my PictureBox结合使用?
我也尝试使用CustomUIItem,但没有成功。我如何为我的标准PictureBox实现这个?
我有什么选择?我错过了什么?
由于
只是为了澄清:
我知道应该在代码中测试这样的东西。相信我,我知道。但不幸的是,这种ui自动化是一项要求,不幸的是......
现在我只需要一种方法来获取图像位置或其他东西。就像我能够在任何WinForms TextBox中获取文本一样。
更新:
这是我的Window的Debug.Details的转储。我希望这有助于理解并希望甚至可以解决我的问题。
---------------------------
---------------------------
AutomationId: Form1
ControlType: ControlType.Window
Name: Form1
HelpText:
Bounding rectangle: 154;203;680;490
ClassName: WindowsForms10.Window.8.app.0.378734a
IsOffScreen: False
AutomationId: progressBar1
ControlType: ControlType.ProgressBar
Name:
HelpText:
Bounding rectangle: 198;488;190;23
ClassName: WindowsForms10.msctls_progress32.app.0.378734a
IsOffScreen: False
AutomationId: Progress
ControlType: ControlType.Button
Name: Start Progress
HelpText:
Bounding rectangle: 198;459;190;23
ClassName: WindowsForms10.BUTTON.app.0.378734a
IsOffScreen: False
AutomationId: PicBox
ControlType: ControlType.Pane
Name:
HelpText:
Bounding rectangle: 619;274;199;140
ClassName: WindowsForms10.Window.8.app.0.378734a
IsOffScreen: False
AutomationId: PicCombo
ControlType: ControlType.ComboBox
Name:
HelpText:
Bounding rectangle: 619;247;199;21
ClassName: WindowsForms10.COMBOBOX.app.0.378734a
IsOffScreen: False
AutomationId: 1001
ControlType: ControlType.Edit
Name:
HelpText:
Bounding rectangle: 622;250;176;15
ClassName: Edit
IsOffScreen: False
AutomationId: ListBox
ControlType: ControlType.List
Name:
HelpText:
Bounding rectangle: 0;21;199;41
ClassName: ComboLBox
IsOffScreen: True
AutomationId:
ControlType: ControlType.ListItem
Name: **********
HelpText:
Bounding rectangle: 1;22;197;13
ClassName:
IsOffScreen: True
AutomationId:
ControlType: ControlType.ListItem
Name: **********
HelpText:
Bounding rectangle: 1;35;197;13
ClassName:
IsOffScreen: True
AutomationId:
ControlType: ControlType.ListItem
Name: **********
HelpText:
Bounding rectangle: 1;48;197;13
ClassName:
IsOffScreen: True
AutomationId: DropDown
ControlType: ControlType.Button
Name: Dropdown-Schaltfläche
HelpText:
Bounding rectangle: 800;248;17;19
ClassName:
IsOffScreen: False
AutomationId: EditRadio
ControlType: ControlType.RadioButton
Name: Edit
HelpText:
Bounding rectangle: 198;420;43;17
ClassName: WindowsForms10.BUTTON.app.0.378734a
IsOffScreen: False
AutomationId: ComboRadio
ControlType: ControlType.RadioButton
Name: Combo
HelpText:
Bounding rectangle: 198;397;58;17
ClassName: WindowsForms10.BUTTON.app.0.378734a
IsOffScreen: False
AutomationId: tb1
ControlType: ControlType.Edit
Name:
HelpText:
Bounding rectangle: 198;303;190;20
ClassName: WindowsForms10.EDIT.app.0.378734a
IsOffScreen: False
AutomationId: btn2
ControlType: ControlType.Button
Name: button1
HelpText:
Bounding rectangle: 198;274;190;23
ClassName: WindowsForms10.BUTTON.app.0.378734a
IsOffScreen: False
AutomationId: btn1
ControlType: ControlType.Button
Name: button1
HelpText:
Bounding rectangle: 198;245;190;23
ClassName: WindowsForms10.BUTTON.app.0.378734a
IsOffScreen: False
AutomationId: TitleBar
ControlType: ControlType.TitleBar
Name: Form1
HelpText:
Bounding rectangle: 158;207;672;26
ClassName:
IsOffScreen: False
AutomationId: Form1
ControlType: ControlType.MenuBar
Name: Systemmenüleiste
HelpText:
Bounding rectangle: 158;207;18;25
ClassName:
IsOffScreen: False
AutomationId: Item 1
ControlType: ControlType.MenuItem
Name: System
HelpText:
Bounding rectangle: 158;207;18;25
ClassName:
IsOffScreen: False
AutomationId: Minimize
ControlType: ControlType.Button
Name: Minimieren
HelpText:
Bounding rectangle: 758;207;24;24
ClassName:
IsOffScreen: False
AutomationId: Maximize
ControlType: ControlType.Button
Name: Maximieren
HelpText:
Bounding rectangle: 782;207;24;24
ClassName:
IsOffScreen: False
AutomationId: Close
ControlType: ControlType.Button
Name: Schließen
HelpText:
Bounding rectangle: 806;207;24;24
ClassName:
IsOffScreen: False
---------------------------
OK
---------------------------
答案 0 :(得分:-2)
那你到底想要测试什么?
我确信MS已经测试了框架中的控件,并且不应该要求进一步的用户测试,除非你不相信框架......