UWP ItemsControl elements

Ask general questions here.
MarkPropel
Posts: 2
Joined: Wed May 30, 2018 10:46 pm

UWP ItemsControl elements

Post by MarkPropel » Wed Aug 22, 2018 9:50 pm

Hi All,

We are building a UWP based client and planning to use Ranorex for UI testing.

Our app has the ability to add plots which are scripted in Xaml as items in an items control. Each plot Xaml is a user control and the first element in the control is a border that surrounds the plot. I've tried adding panels and naming various items but for some reason the plots when added do not show up in SPY with a grouping control. IE the plot elements show up, buttons, images, sliders, but each plot looks the same to Ranorex.

So if I add a plot and look in SPY I do not see the border or grids. I only see the elements inside the border. So plot 1 might have:

button
button
text 0
text 128
text 256
slider Yslider
slider Xslider

If I add a second plot the list just gets bigger as in:

button
button
text 0
text 128
text 256
slider Yslider
slider Xslider
button
button
text 0
text 128
text 256
slider Yslider
slider Xslider

In this case it is virtually impossible to know that slider Yslider is on plot 1 or plot 2 from a test case basis.

I also think the Ranorex repository is giving us trouble because these plots are dynamically created. I tried putting a TextBox on the user control with a name of "Plot". I can see this in SPY so I wrote a short test that would press a button to add a plot then look for that TextBox with name containing the word "Plot". It ran once when I built the test. After I shutdown our app and restarted it and tried to run the test again it now fails as if the "plot" textbox in the repository does not match the one that is actually running. SPY definitely shows the text box as being there and having the value "Plot".

My questions are:

1) Why can't I see any of the grouping controls like borders and grids? Even if I give them names they do not show up in SPY

2) How do I deal with runtime generated elements like above? Our plots use the same base user control so the elements of the plot would all have the same names, IDs, etc. I could bind to different IDs but how would Ranorex know what those are?

3) How does the repository deal with dynamically generated items? As mentioned above I could find an item and check it but upon restart of the code it seemed to fail to find that item. Is there some way to refresh or regen the repository or how do you deal with dynamically created elements?

Thanks in advance!

Mark

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: UWP ItemsControl elements

Post by qwertzu » Fri Aug 24, 2018 10:00 am

Hi,
Could you upload a Ranorex Snapshot and a compressed report of a failed test run in which the element cant be found?
Otherwise it would be hard to help.
regards, qwertzu

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: UWP ItemsControl elements

Post by odklizec » Fri Aug 24, 2018 10:03 am

Hi,

Additionally, to what qwertzu suggested, I would suggest to check this blog post, regarding test automation of dynamic IDs...
https://www.ranorex.com/blog/automated- ... namic-ids/
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration