Ask a Question

Help! lightweight find method for flex/flash application needed.

SOLVED
Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

Alex,
 yes your solution is exactly what i plan to do, although im am trying to build an excuting script using test complete and run my steps off of an excel file. So i want to stay away from using name mapped items inside the project. I need to be able to hand a parent control using a column in my xls to help narrow the search. Unfortunalty I can think of a number of ways that this could cause issues in playback. So any tips and tricks i can use would be helpful.
In order to call the parent object without a name mapping I think i'm going to have to use the full name of the control.
I'm not sure off the top of my head if i am able to use wildcards in the full name of an object in test complete, if i can that would help keep scripts from breaking when something in the full name has changed.

 

so my executing script might look something like

 

minus the hard coded string 🙂


var parent = Project.Variable.Process + Project.Variable.TestItem("Parent Object Full Name Minus Sys.Browser().Page()");

parent.Find(propNameArray, propValArray, depth);

 

currently my process name is built off the browser and evironment of my tested application specified to test against 
so it looks like 

Sys.Browser(browser).Page(url);

 

so i guess the question now is would something like this work when refrencing the full name of the parent.
Sys.Browser(browser).Page(url).object("myobj*").object("m?obj").Find(propArray,valArray,depth);

I hope that makes sense 😛 sorry its been a long day already.

Thanks

Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

Ryan
 Awesome! I'm Going to try this right now XD
 Thanks, Its much cleaner this time to.

Ryan_Moran
Valued Contributor

Re: Help! lightweight find method for flex/flash application needed.

Sure, just note I did not include the second matchproperty function because I made no changes to that. 🙂


''-Praise the sun and Give Kudos.''
Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

Ya, I noticed the missing function 😛 

Two things:
Have you run a speed comparison between your function utilizing testcompletes find all method and testcompletes find method? If your showing faster times with your method I would be interested in seeing those results as it may suggest that I have an issue elsewhere with my machine.

Also when utilizing the RegEx i recieve an error when the property value looks like "*(1718-000-2013)"
Testcomplete supports the utilization of the "*" at the start of the string yet RegEx would need to have the string reversed and the "*" placed at the end of the string.

Still regardless of which method I have tried, I still find that I need to define closer parent than just the process itself.

I am working on difining this solution in my project still.

Thanks.

 

P.S. I'm not a regex master!

Ryan_Moran
Valued Contributor

Re: Help! lightweight find method for flex/flash application needed.

Q: "Have you run a speed comparison between your function utilizing testcompletes find all method and testcompletes find method?"

A: Negative. I assume the built in method is inefficient, but would be happy to be proven wrong.

 

Q: "Testcomplete supports the utilization of the "*" at the start of the string yet RegEx would need to have the string reversed and the "*" placed at the end of the string."

 

A: As my original code notes say ".*" is the same as TestComplete's "*" wildcard and ".?" is the same as TestComplete's "?" wildcard. Regular Expression Syntax

[Edit] added example corrected regex syntax

Ex: ".*myForm.*" same as TC "*myForm*" matches "WinFormsObject("myForm")" and "WinFormsObject("myForm", 2)"

Ex2: "my.?orm" same as TC "*my?orm*" matches "myZorm" and "myorm" 

 

Q: "Still regardless of which method I have tried, I still find that I need to define closer parent than just the process itself."

A: I agree. You should at least limit your search to the page object. However if you are having to then specify a panel or other parent object you aren't exactly achieving a "dynamic" search/find function because it requires prior knowledge of the heirarchy, beyond the page/browser and some generic name or text to find, and leaves you just as vulnerable to hierarchical changes that break your tests.


''-Praise the sun and Give Kudos.''
Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

However if you are having to then specify a panel or other parent object you aren't exactly achieving a "dynamic" search/find function because it requires prior knowledge of the heirarchy, beyond the page/browser and some generic name or text to find, and leaves you just as vulnerable to hierarchical changes that break your tests.

 

-- Agreed, But im not sure what to do testcompletes findall method and find method is the hang up, this is where the performance suffers. Short of finding a way to find controls without using these methods, idk what else to do.

It would be nice to get some feedback from smart bear for these methods and maybe why the caching is doing this, maybe how to disable or clear it and some comment as to maybe how to increase speed when searching through so many objects.

I will say that both of our methods would work against smaller tested apps. 🙂

Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

As a thought i could store the array from the findall in your method and try to find controls from that array and re-execute the findall when we fail to identify an object from the stored array... this would reduce the number of times the find all had to execute and keep us from the heafty wait times and reduce the memory used during testing ... i still dont think its going to be a real solution to the issue though.

also i wounder if we could check controls in our array for child controls and find all children.

Antonio_Haynes
Contributor

Re: Help! lightweight find method for flex/flash application needed.

Just to follow up with this thread using the browser.find method is working great for me now .... i have managed to remove the name mapping and the tested applications from my project entirely after wich i no longer have any issue with memory i find my controls based on property name/value pairs and im able to pass any process as a tested process and then begin mapping controls using my methods this has opened a great platform for creating automated tests against any platform. I'm in no way trying to play down the name mapping and tested applications included with test complete but i find that this method is much more suitable to automating in my current environment. Thanks for the input in helping me toward my solution!

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: