如何制作PowerBuilder UI测试应用程序?
我不熟悉 PowerBuilder,但我有一个任务为 PB 创建自动 UI 测试应用程序。我们决定使用 pywinauto 和 iaccesible 库在 Python 中完成此操作。问题是某些 UI 元素(例如新添加的列表记录)无法从中访问(甚至 Inspect32 也无法获取)。 有什么想法如何实现这些元素并使它们可测试吗?
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it).
Any ideas how to reach this elements and make them testable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我也在试验用于自动化基于 PowerBuilder 的 GUI 的工具的代码。据我所知,最好的选择是使用 PowerBuilder 本机接口 (PBNI),并从 NVO 中调用 PowerScript 代码。
如果您愿意,请随时给我发送电子邮件(请参阅我的个人资料中的电子邮件地址),我有兴趣交流有关如何执行此操作的想法。
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO.
If you like, feel free to send me an email (see my profile for my email address), I'd be interested in exchanging ideas about how to do this.
我有一段时间没有使用 PowerBuilder,但我猜您想要解决的问题与我试图为使用 Wonderware Intouch 等 SCADA 系统制作项目的人们解决的问题类似。
此类应用程序的问题在于没有 API 来获取或设置控件的值。所以 pywinauto 方法行不通。
我制作了一个小工具来模拟用户事件并从屏幕截图中获取结果。我使用 PIL 和 pytesser ORM 来分析屏幕截图。这不是最简单的方法,但效果还不错。
该工具是开源且免费的,可以从我的网站< /a> (对不起,法语)。您只需要一个帐户,但它也是免费的。就问吧。
如果您可以阅读法语,这里是 一篇关于测试基于 Intouch 的应用程序的文章
抱歉自我推销,但我面临着类似的问题,但没有解决方案,所以我自己写了一篇。无论如何,这是免费和开源的......
I didn't use PowerBuilder for a while but I guess that the problem that you are trying to solve is similar to the one I am trying to address for people making projects with SCADA systems like Wonderware Intouch.
The problem with such an application is that there is no API to get or set the value of a control. So a pywinauto approach can't work.
I've made a small tool to simulate the user events and to get the results from a screencapture. I am usig PIL and pytesser ORM for the analysis of the screen captures. It is not the easiest way but it works OK.
The tool is open-source and free of charge and can be downloaded from my website (Sorry in french). You just need an account but it's free as well. Just ask.
If you can read french, here is one article about testing Intouch-based applications
Sorry for the self promotion, but I was facing a similar problem with no solution so I've written my own. Anyway, that's free and open-source...
我在 AutomatedQa 支持中看到他们推荐使用 msaa 并在控件上设置一些属性。我不知道它是否有效。
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
如果您正在测试DataWindows(类是pbdwxxx,例如pbdw110),您将必须使用单击特定坐标和发送Tab 键的组合来到达您想要的控件。当然,您也可以发送向上和向下箭头键在行之间移动。最简单的方法是从普通控件(如 SLE)开始,然后按 Tab 键进入数据窗口。问题是数据窗口本质上只是一个图像。在通过单击或按 Tab 键将焦点移动到该字段之前,无法对给定字段进行控制。我还发现 DataWindow 的 iAccessible 界面有点奇怪。如果您向数据窗口询问具有焦点的对象,您将不会得到正确的答案。如果您枚举所有子项,您就可以找到具有焦点的那个。如果您可以修改源代码,我还建议您为 DataWindow 控件设置 AccessibleName,否则您可能无法识别除位置之外的控件(我所说的 DataWindow 控件是指 DataWindow 内部的控件,而不是 DataWindow 本身) 。如果它是 MDI 应用程序,您可能还会发现定位 MicroHelp 窗口(类 fnhelpxxx,例如 fnhelp110,从主应用程序窗口中查找)很有用,可以帮助确定您当前的上下文。
编辑添加:
Sikuli 看起来非常适合测试 PowerBuilder。它的工作原理是从保存的屏幕截图片段中识别屏幕上的对象。也就是说,您可以截取您希望其查找的屏幕部分的屏幕截图。
If you are testing DataWindows (the class is pbdwxxx, e.g. pbdw110) you will have to use a combination of clicking at specific coordinates and sending Tab keys to get to the control you want. Of course you can also send up and down arrow keys to move among rows. The easiest thing to do is to start with a normal control like an SLE and tab into the DataWindow. The problem is that the DataWindow is essentially just an image. There is no control for a given field until you move the focus there by clicking or tabbing. I've also found that the DataWindow's iAccessible interface is a bit strange. If you ask the DataWindow for the object with focus, you don't get the right answer. If you enumerate through all of the children you can find the one that has focus. If you can modify the source I also advise that you set AccessibleName for your DataWindow controls, otherwise you probably won't be able to identify the controls except by position (by DataWindow controls I mean the ones inside the DataWindow, not the DataWindow itself). If it's an MDI application, you may also find it useful to locate the MicroHelp window (class fnhelpxxx, e.g. fnhelp110, find from the main application window) to help determine your current context.
Edited to add:
Sikuli looks very promising for testing PowerBuilder. It works by recognizing objects on the screen from a saved fragment of screenshot. That is, you take a screenshot of the part of the screen you want it to find.