Ich werte gerade das White-Test-Framework aus. Ziemlich tolle Sachen!PictureBox in Weiß testen
Alles sieht ziemlich vielversprechend aus, aber ich bin in eine kleine Mauer gelaufen.
Wie kann ich eine .NET 2.0 PictureBox testen?
Dafür gibt es kein vordefiniertes UIItem. Obwohl es die Image-Klasse gibt, aber wie würde ich sie in Kombination mit meiner PictureBox verwenden?
Ich habe auch versucht, ein CustomUIItem zu verwenden, aber ohne Erfolg. Wie würde ich dies für eine Standard-PictureBox implementieren?
Was sind meine Optionen? Was habe ich verpasst?
Dank
Gerade clearify:
Ich weiß, dass so etwas wie dies in Code getestet werden sollte. Glaub mir, ich weiß es. Aber leider ist diese ui Automatisierung eine Voraussetzung, leider ...
Jetzt brauche ich nur einen Weg, um vielleicht den Bildort oder etwas zu bekommen. Genauso wie ich den Text in jeder WinForms TextBox bekommen kann.
Update:
Dies ist ein Auszug der Debug.Details für mein Fenster. Ich hoffe, dass dies hilft, mein Problem zu verstehen und hoffentlich sogar zu lösen.
---------------------------
---------------------------
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
---------------------------
ich meinen eigenen Code testen möchten. Es ist nur zur Bewertung. Ich möchte WinForms automatisieren. Die Bildsuche ist eine nicht-triviale Aufgabe. Und ich möchte jetzt testen, ob das richtige Bild in meiner PictureBox angezeigt wird. Ich weiß, ich könnte das wahrscheinlich nur im Code testen. Aber leider, "der visuelle Weg", ist eine Voraussetzung. Ich hätte es auch anders gemacht ... – eric
Also, wie testen Sie eine visuelle Erscheinung? Ich denke nicht, dass das sehr gut möglich ist, es sei denn, man vergleicht es mit Screenshots oder so. – leppie
Nein, nur der Pfad zum Bild oder etwas. Just Like TextBox.Text Ich möchte PictureBox.Image erhalten – eric