views:

176

answers:

1

Hello,

I am currently evaluating the White testing framework. Pretty amazing stuff!

Everything looks pretty promising, but I have run into a small wall.

How can I test a .NET 2.0 PictureBox?
There is no predefinied UIItem for that. Though there is the Image class, but how would I use it in combination with my PictureBox?
I also tried to use a CustomUIItem, but with no success. How would I implement this for a my standard PictureBox?

What are my options? What did I miss?

Thanks



Just to clearify:
I know that something like this should be tested in code. Believe me I know. But unfortunately this ui automation is a requirement, unfortuanetly...

Now I just need a way to maybe get the image location or something. Just like I am able to get the text in any WinForms TextBox.


Update:

This is a dump of the Debug.Details for my Window. I hope this helps to understand and hopefully even solve my problem.

---------------------------
---------------------------
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   
---------------------------
A: 

So what exactly are you trying to test?

I am sure MS has tested the controls in the Framework already, and should not require further user testing, unless you dont trust the Framework...

leppie
I want to test my own code. Its just for evaluation. I want to automate WinForms. The image retrieval is a non-trivial task. And I now want to test if the correct image is displayed in my PictureBox. I know I probably could just test this in code. But unfortuanetly, "the visual route", is a requirement. I would have done it differently aswell...
oreon
So how will you test a visual appearance? I dont think that is very possible unless you compare it to screenshots or something.
leppie
No just the path to the image or something. Just Like TextBox.Text I want to be able to get PictureBox.Image
oreon