Validating multiple items from repository at once

Ranorex Spy, Recorder, and Studio.
jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Validating multiple items from repository at once

Post by jt1 » Fri Sep 25, 2015 4:23 pm

Hello,

I was wondering if there is a way to select multiple repository items and move them to a recording at the same time, applying the same action to all. For example, validating that all items in a dropdown list exist.

Thank you

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

Re: Validating multiple items from repository at once

Post by odklizec » Mon Sep 28, 2015 7:51 am

Hi,

Nope, there is currently no way to drag&drop multiple repo items to recording and set them an action. Anyway, I think it would be better idea to validate the content of List/Combo box via code. Validating list items via recording could work only with simple combo/list boxes with only few items. Validating large lists with 10+ items must be a nightmare via Recording, not to mention it could easily fail (e.g. if the order of list changes).

I would personally use CSV list of elements together with a clever foreach loop, which would iterate through the list items and validate them against the CSV file (even if the items are not in the same order). There is couple of discussions about validating combo/list boxes. Check for example these...
http://www.ranorex.com/forum/validating ... t3979.html
http://www.ranorex.com/forum/validate-a ... t1145.html

Here is a basic code to obtain the list of element from given repo item and loop through the individual items...
public void ListAllComboBoxElements(Ranorex.Core.Repository.RepoItemInfo repoElement)
        {
        	        	//create IList of all elements, available to given repo element
			IList<Ranorex.OptionTag> allElementsList = repoElement.CreateAdapters<Ranorex.OptionTag>();
	
			//go through the list of all elements and do whatever you want with each item
			foreach (Ranorex.OptionTag optionTag in allElementsList)
			{
				string optionTagValue = optionTag.Element.GetAttributeValueText("Value");
				Report.Info("List items", "List item: " + optionTagValue);
			}
				
        }
And this is how it should look like in recording...
ListComboItems.png
ListComboItems.png (24.16 KiB) Viewed 1467 times
Hope this helps?
Last edited by odklizec on Tue Sep 29, 2015 2:41 pm, edited 1 time in total.
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

jt1
Posts: 16
Joined: Fri Sep 25, 2015 4:18 pm

Re: Validating multiple items from repository at once

Post by jt1 » Tue Sep 29, 2015 2:29 pm

Yes, that gave me some ideas to try out. Thank you!