Any pitfalls with making most of the aliases on the root level?
I'm testing an Android app. I've been building out the Namemapping and Aliases. I'm wondering if there's anything I should be aware of if I copy most of the objects onto the root level of the Alias section for easy access. Otherwise, I typically have to drill down 7 to 11 levels deep just to get to them.
Off the top of my head, make sure all names are unique. Else you get run time errors, or logic errors as TC references the wrong object.
Solved! Go to Solution.
Thanks for your question @ackmondual !
@AlexKaras @anupamchampati @BenoitB @tristaanogre , any advice?
Community and Education Specialist
Are you using keyword tests or scripting? If you're writing scripts you can assign your name mapping to variables, making that the new root.
e.g. mainPage = Aliases.App.HwndSource_Window.Window.MainFrame.MainPage;
You can do this for keyword tests by setting a project-wide variable and using that.
I would think it's generally not a good idea to copy them to the root level, unless you can be sure they're all unique and they have unique identification properties. They're in a hierarchy for a reason 😉
Senior SQA Automation Engineer
> if there's anything I should be aware of
Nothing that I can think of. (Obviously, given that aliased names are unique.) Actually, this is one of the purposes of Aliases: to make mapped objects' tree to be less deep and be more convenient for use in test code.
/Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.