Forum Discussion
Correct, mapping all those components is a pain sometimes... but you only ever have to do it once and then they are identified and available for use in any test. Generally speaking, this is going to execute faster as well. Running script code to find your components means you're doing two things that are going to slow down your execution. First, you're running interpreted script code which will take longer than compiled internal methods (like NameMapping). Secondly, any "Find" method is going to take execution time.
What you're talking about doing, though, is something akin to a Page Object Model where you build a code unit whose only purpose is to identify a component and return it to the rest of the application. It can be done... but you're reinventing the wheel. You'd have to write the code to identify all the components... might as well map them.
- liquidphantom9 years agoOccasional Contributor
I have a VB6 app to deal with that is still being developed (don't ask) that has gone waaaaay beyond the number of controls limit on a form, using picBoxs etc. These controls change their names pretty much every build so no good mapping them.
I had to write a function using 'FindChild' to find a child object of one of it's containers by a partial of it's name and it's index value. Then for each action call this function.
Sometimes pre-mapping all the objects isn't an option.
- tristaanogre9 years agoEsteemed Contributor
liquidphantom wrote:
I have a VB6 app to deal with that is still being developed (don't ask) that has gone waaaaay beyond the number of controls limit on a form, using picBoxs etc. These controls change their names pretty much every build so no good mapping them.
I had to write a function using 'FindChild' to find a child object of one of it's containers by a partial of it's name and it's index value. Then for each action call this function.
Sometimes pre-mapping all the objects isn't an option.
Wow... well, yeah, in that case, definitely need to find some other way around... but that's assuming that the "Name" property is the only property that matters for mapping. I'm working with an application right now that has a LOT of components that, for the most part, look almost exactly the same in the Object browser with regards to the VB6 name property... however, using things like "WndCaption" or other similar values, we've found a way to uniquely map the objects... it takes a bit more work than just using the Name, but it does eventually work...
... but suffice it to say, you're experience is one where, perhaps, using an alternative method may be better.... or, sit down with the development staff and say, "Hey, ya know... my automation is here to help you... but it's a bit difficult to do this with the dynamic factors you've introduced. Can we establish some sort of identification methodology to enable the automation to work better?"... of course, this implies that your developers see the test automation as a benefit... but that's another story. :)