HP-QTP 中是否支持 OO 语言?
在 Quick Test Professional 中坚持过程式编程似乎很痛苦。通常需要编写大量代码,否则 OO 语言可能不需要编写大量代码。你怎么说?
It seem to be a pain to stick to procedural kind of programming in Quick Test Professional. Often large no of lines of code need to be written which otherwise can be not required with OO langiages. What do you say?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您仍然可以通过 VBScript 使用继承和重载,尽管方式与 C++ 中的方式不同。
查看 AdvancedQTP 网站和文章“类组合”或“函数指针”。
我有一篇文章“重载您的VBScript函数”,其中包含代码示例在我的博客中。
You can still use inheritance and overloading with VBScript, although not in the same obvious way as in C++.
Check out AdvancedQTP website and articles "Class Composition" or "Function Pointers".
I have an article "Overload your VBScript functions" with code examples in my blog.
这一切都取决于您使用的框架。好吧,如果你问我是否可以用你最喜欢的 OOP 语言(比如 C++、Java 或 Python)开发整个框架。
我来说说怎么做吧。如果我的测试脚本仅包含以下脚本
While Environment.value("Statement") <> ""
执行Environment.value("Statement")
Wend
您需要使用QuickTest API 从外部控制环境变量。
因此,当您运行测试时,它会在无限循环中运行,检查环境值的值。
现在,在您最喜欢的 C++ 语言的帮助下,您已将环境变量值设置为
“浏览器(“Google”)。页面(“Google”)。WebEdit(“SearchField”)。设置“你好””
该值会反映在 QTP 测试中并执行该语句。
因此,很可能用 java 或 C++ 开发整个框架。正如我所说,这完全取决于您的组织正在使用的框架。
This all depends on the framework you are using. Well if you ask me its possible to develop entire framework in ur fav OOP language say either C++ or Java or Python.
Let me say how. if my Test script contains only the following script
While Environment.value("Statement") <> ""
Execute Environment.value("Statement")
Wend
You need to control the environment varialbe from outside using QuickTest API.
So when you run the test it runs in an infite loop checking the value of the environment value.
Now with the help of a ur fav C++ lang, u had set the environment variable value to
"Browser("Google").Page("Google").WebEdit("SearchField").Set 'hello' "
this value gets reflected in QTP test and executes the statement.
Hence its very much possible to develop you entire framework in java or C++. As i said it all depends on the framework ur organisation is using.