Page 1 of 1

Validating multiple items from repository at once

Posted: Fri Sep 25, 2015 4:23 pm
by jt1
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

Re: Validating multiple items from repository at once

Posted: Mon Sep 28, 2015 7:51 am
by odklizec
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
Hope this helps?

Re: Validating multiple items from repository at once

Posted: Tue Sep 29, 2015 2:29 pm
by jt1
Yes, that gave me some ideas to try out. Thank you!