Set Object Reference in UFT with or without the “Execute” Statement

允我心安 提交于 2019-12-06 16:23:59

As long as the Executed code is pre-defined and doesn't contain any parts that are determined dynamically by the test I don't see any benefit of using Execute.

An example of dynamic code may be something like this contrived example which determines what the variable is called according to some previously computed value theType.

Execute "Set obj" & theType & " = XamRibbonWindowAddin(""XamWindow_DashBoard"").Wpf" & theType & "(""Save"")"

Then if theType is Button it will define the variable objButton and if it's Edit it will define objEdit.

As I said this is a contrived example, I've never ran across anything that would require you to use Execute in UFT.

Since you're entering into an existing code base, consistency has it's values. If possible I would ask one of your more experienced co-workers what motivated them to use this construct to better form an opinion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!