access to message in side listview

Mar 22, 2012 at 2:46 PM

Hi  ,i am  tried acess  to the message  in the  listview  but no working never  ,i  have small screen to save  data   after finish load data   I  press  button save  ,then  appear  message inside listview  say  load data  has been done. i access  to listview  by automation id :

 

var searchCriteri9 = SearchCriteria.ByAutomationId("MessagesListBox");

var showmessage = mainWindow2.Get<ListView>(searchCriteri9);

Assert.AreEqual("data has been done",showmessage );



i need  help me  why not working  ,and i hope  suggest  me  some way to access  content  inside  listview using white

many thanks



Mar 22, 2012 at 3:05 PM

Hi

first send some information:

which white version, which OS and type of Application (WPF, Silverlight or WinForm)

than have a look into UIAverify or UISpy and post structure of elements here. (ControlType, automationID, parent, child.....)

First idea: The ControlType element is not the same as the automatioID Elemement

most such messages are labels (ControlType.Text)

Throndorin

Mar 23, 2012 at 9:06 AM

 

thank you 

I  used  White_Bin_0.2.1 and  OS ,Windows 7  my machine  64 bit  ,my application  WPF,  and  i used  UISpy  to  specify   the  controls  in my screen

controlType:  listview

automationID:"MessagesListBox"

parent:"btnSave" just message  appear after  press  button save.

i  tried  used  this  code

 

Assert.AreEqual("data has been done", showmessage.Row("data has been done","0");

 the reading  from UISpy

Identification

ClassName: "ListBox"

ControlType: "ControlType.List"

Culture: "(null)"

AutomationId: "MessagesListBox"

LocalizedControlType: "list view"

Name: ""

ProcessId: "5588 (Bcc.Presentation)"

RuntimeId: "7 5588 66185246"

IsPassword: "False"

IsControlElement: "True"

IsContentElement: "True"

 

thanks  again

 

 

Mar 23, 2012 at 10:05 AM

Hi

If I see it correct You don't have a DataGrid which has the White Item ListView. Have a look here: ControlTypeToUIItemMapping

The White Item you need is ListBox. ListBox don't contains rows but ListBoxItems.

If the ListBoxItem contains Rows the developer mixed it in a bad way :)

what are the children of the element?

 

Throndorin

Mar 23, 2012 at 2:17 PM

 

Hi

many  thanks

i  modify  to  listBox  when I  tried  to use the code  

Assert.AreEqual("data has beenload" ,showmessage.Items(0).Text);

I  got  result  but  i ask you   are this  best way  to access  my message??


is there another way?

Mar 23, 2012 at 4:01 PM

Hi

no this is the fasted way. In my opinion it is curious to use a ListBoxItem in ListBox to show a message. Why not a label?????

if you implement tests with UIAutomation and White. The best way to get Items is. To get them from the context.

 

You can search for the ListBoxItem by AutomationID (if set) directly from top of the app. But this is not good design, because there might be a similar item in another context.

Throndorin

Mar 28, 2012 at 11:55 AM

 

Hi

firstly  i  thank you  for your help,  i would  like  to  ask  you  ,is there are   any report mechanism  in  white?

 

Mar 28, 2012 at 12:02 PM

no there is no report mechanism.

For reporting you can integrate lo4net for example (here an example)

if you need it for error reporting, than you can better use Nunit as test execution framework

Throndorin

Mar 28, 2012 at 12:51 PM

 

thanks

 

 my desire  when executing  my  test   ,   I find  mechanism   to show me  any  test pass  and  any  fail.

 

 

Mar 28, 2012 at 1:10 PM

nunit!!!!!!!!!!!!!!!!!!!!