This code takes forever when part of Test Suite

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

This code takes forever when part of Test Suite

Post by stapes » Wed Oct 21, 2015 3:06 pm

This piece of code runs almost instantly when run in isolation.
When I run it as part of a Test Case / Test Suite, it takes forever, but it does - eventually - work

Why would this be?
Do you know a better way of doing this?

Code: Select all

public void SelectUserFromSearchResults()
        {

        	// this looks in the Search Results table for varSelectedUser and returns the index of this row as varIndex
        	
        	Ranorex .Table myTable=repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.Table282;
        	IList<Row> rows = myTable.FindDescendants<Row>();
        	int selectedIndex=-1;
        	bool found=false ;
        	foreach (Row row in rows )
        	{
        		foreach (Cell cell in row .Cells )
        		{
        			string value=cell .Text;
        			if(value.Contains (varSelectedUser))
        			{
						selectedIndex=row .Index ;
						varIndex =selectedIndex.ToString () ;
						found =true ;
						break ;
        			}
        			if(found )
        			{
        				break ;
        			}
        		}
        		if(found )
        			{
        				break ;
        			}
        	}
        	if(!found )
        	{
        		Report.Log(ReportLevel.Failure , "Search", "Validating Exists on item 'SelectUsersOrGroups.UsersTable.Table282'.", repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.Table282Info);
            
        	}


            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left DoubleClick item 'SelectUsersOrGroups.UsersTable.SearchResultsGrid.SelectedDomainUsers' at 46;14.", repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.SelectedDomainUsersInfo);
            repo.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.SelectedDomainUsers.DoubleClick("46;14");

// SelectedDomainUsers is defined in the Repository as: /table/row[@index=$varIndex]/cell[@text=$varselecteduser]
        }

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: This code takes forever when part of Test Suite

Post by Support Team » Thu Oct 22, 2015 1:55 pm

Hi stapes,

Do you get any error messages?
Did you already try to set a break point and debug it. What are the values of the variables when you debug the code?
Is the application in the correct state when your code is executed?

Regards,
Bernhard
.
Image

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: This code takes forever when part of Test Suite

Post by stapes » Fri Oct 23, 2015 1:44 pm

Here is a warning message that is probably relevant:
Item 'Test_365AgilePortalRepository.SelectUsersOrGroups.UsersTable.SelectUsersOrGroupsAdvanced.Table282.Self' could be found using its absolute path, but not using its relative path from the cached element of parent folder 'Test_365AgilePortalRepository.SelectUsersOrGroups'. This can happen if either the item search timeout is too small or if items within a rooted folder do not share a common parent element. To fix this problem, first increase the item search timeout. If this does not help, create a separate rooted folder for this item or disable caching for the specified folder.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: This code takes forever when part of Test Suite

Post by Support Team » Fri Oct 23, 2015 2:04 pm

Hi stapes,

Thank you for the error message.

It seems that the caching information of a parent folder is incorrect.
Please read the section "Repository Troubleshooting - Folder Caching" in our user guide.

Please also read the following thread which treads a similar issue.
http://www.ranorex.com/forum/how-do-i-f ... t1357.html

Regards,
Bernhard
.
Image