views:

438

answers:

5

Hi. 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?

+2  A: 

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.

Frerich Raabe
+1  A: 

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...

luc
Hi. Our Python application works quite fine besides some excpetions. We do not set directly the control value but say to system for example: "go to the fallowing position x,y type some text and click enter" We're using pywinauto and iaccesible to find control and get posiotion, value etc. But the problem is that there are some elements that pywinauto either iaccesible can't find.
Jerzy Sekuła
+1  A: 

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.

Hugh Brackett
A: 

Hello, I am using version pyWinauto 0.3.9 and I have similar problems to automate PowerBuilder application (using MDI). The first screen is a login screen ... This one seem to be handle correctly by pywinauto ... Control Identifiers: Button - 'OK' (L690, T444, R744, B471) 'Button' 'Button0' 'Button1' 'OK' 'OKButton' ComboBox - 'Fran\xe7ais' (L706, T410, R821, B433) 'ComboBox' 'ComboBox0' 'ComboBox1' 'Langue :ComboBox' Button - 'Langue :' (L638, T412, R702, B431) 'Button2' 'Langue :' 'Langue :Button' Edit - '' (L706, T378, R821, B401) 'Edit' 'Edit0' 'Edit1' 'Mot de Passe :Edit' Button - 'Mot de Passe :' (L616, T380, R702, B399) 'Button3' 'Mot de Passe :' 'Mot de Passe :Button' Edit - 'ULIS' (L706, T346, R821, B369) 'Edit2' 'Id. Utilisateur :Edit' Button - 'Id. Utilisateur :' (L609, T348, R702, B367) 'Button4' 'Id. Utilisateur :' 'Id. Utilisateur :Button' ComboBox - 'NEUPLOCA' (L706, T314, R821, B337) 'ComboBox2' 'Profil :ComboBox' Button - 'Profil :' (L648, T316, R702, B335) 'Button5' 'Profil :' 'Profil :Button' Button - '' (L598, T298, R836, B474) 'GroupBox' 'Id. Utilisateur :GroupBox'

However, the power builder application seem to use MDI screen and then these objects doesn't seem to be recognized properly ... No property available ... For example, I can't see control the menu... nor any child window ...

Control Identifiers: FNFIXEDBAR90 - '' (L0, T46, R1424, B72) '' '0' '1' 'FNFIXEDBAR90' FNHELP90 - 'D\xe9marrage...' (L0, T732, R1424, B750) 'D\xe9marrage...' 'D\xe9marrage...FNHELP90' 'FNHELP90' MDIClient - '' (L0, T74, R1424, B734) '2' 'MDIClient'

Is anyone have experience with this kind of issue? Is there alternative? Thanks a lot, Laurent

Laurent
This seems to be a different question, so don't post it as an answer to this one. Post it as a new question instead (And format your code so that it is readable).
sth
A: 

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.

Claudio
The limitation of using MSAA to assist with testing is that PowerBuilder only offers the MSAA information that the developer explicitly provides, with a couple of exceptions. Note that I'm speaking of classic PB here, I haven't poked around in the WinForms. I've added MSAA support to many of the PFC controls in our mid-tier.
Hugh Brackett