1

I need to automate installation process of some product, but it has to be exactly installation through passing InstallAnywhere wizard (it's kinda GUI testing of installation process, so silent install won't work). Any suggestion how to do this?

I guess the main problem is that installation file (*.exe) is just extractor which extract required files to temp folder and then run java application.

Insane Skull
  • 9,220
  • 9
  • 44
  • 63
marvellous
  • 81
  • 8
  • Which language do you prefer for writing the tests? Java only? Or maybe Python is acceptable? – Vasily Ryabov Feb 02 '16 at 06:12
  • Java is preferred, but if you have good decision with Python I would like to look at this and consider. – marvellous Feb 02 '16 at 06:44
  • We have an example of installer GUI testing automation: http://stackoverflow.com/questions/32846550/python-control-window-with-pywinauto-while-the-window-is-minimized-or-hidden But for Java part of the installer it wouldn't work I think. But we have an experimental solution (will be released in March) that may work. So what is about early testing? – Vasily Ryabov Feb 02 '16 at 08:15
  • Since I have no options I would try it. – marvellous Feb 02 '16 at 08:47
  • One more detail: do you plan to test your installer in a cross-platform way? Or one OS only? – Vasily Ryabov Feb 02 '16 at 09:52
  • Sorry, I didn't take it into account. I can suggest Windows only solution for now. You may try LDTP for cross-platform GUI but it's not easy to learn. – Vasily Ryabov Feb 02 '16 at 10:16
  • I hope to do it in cross-platform, but different Windows versions would be a good start. – marvellous Feb 02 '16 at 10:17
  • Many other tools are very platform dependent. We have long-term plans to extend pywinauto to Linux and maybe OS X. But now it's Windows only. Okay, I'll try to provide the info for early testing. – Vasily Ryabov Feb 02 '16 at 10:19

1 Answers1

0

You may try pywinauto to test it on Windows. Java part of the installer may require new "UIA" back-end which will be released in March. For early testing you may try the following steps:

  1. Install pyWin32 and comtypes by pip install pypiwin32 and pip install comtypes.
  2. Install UIA branch of pywinauto by python setup.py install.

Try the following code:

import pywinauto
pywinauto.backend.activate('uia')

app = pywinauto.Application().start('your_installer_path.exe')
app.ApproximateMainWindowName.Wait('ready', timeout=15)
app.ApproximateMainWindowName.PrintControlIdentifiers()

PrintControlIdentifiers output is a hint for further steps. There are possible access names for the controls on the window. Only basic functionality like ClickInput() and TypeKeys('something') should work for now.

Available methods for the control can be advised here:

app.MainWindow.OKButton.WrapperObject(). # methods list can be displayed here in IDLE or Visual Studio Python Tools
app.MainWindow.OKButton.WrapperObject().ClickInput() # code for debugging
#app.MainWindow.OKButton.ClickInput() # it works the same way, for production code

Feel free to ask more help if something doesn't work.

Python scripts may require running as Administrator to have an access to the GUI. Or add manifest for python.exe with uiAccess="true".

Vasily Ryabov
  • 9,386
  • 6
  • 25
  • 78
  • I've tried it and looks like it doesn't work with java app. The start window (InstallAnywhere extracter) can be worked with, but the actual wizard part cannot be handled and fails with timeout on waiting. – marvellous Feb 03 '16 at 04:27
  • To be honest, I don't know how it works, but seems like there is a link between app object and exe-file, if so the problem probably is here, because the java app is not run from this exe-file. – marvellous Feb 03 '16 at 04:33
  • I've tried to connect by process id, and it doesn't help so much. The wizard has been found by title at least, no controls are available inside though. – marvellous Feb 03 '16 at 06:55
  • Hmm... I'm not sure, but what if [Java Access Bridge](http://www.oracle.com/technetwork/articles/javase/index-jsp-136191.html) would help? I've not dived into Java Accessibility yet. Just saved the link for future. – Vasily Ryabov Feb 03 '16 at 09:13
  • The best scenario would be "just install or run Java Access Bridge and enjoy", the worst case may require implementation of new back-end for pywinauto. I'm afraid the second one is most probable. – Vasily Ryabov Feb 03 '16 at 09:16
  • I've found [how to enable Java Access Bridge](http://docs.oracle.com/javase/7/docs/technotes/guides/access/enable_and_test.html) in Control Panel. It's easy and doesn't require to install anything. – Vasily Ryabov Feb 03 '16 at 09:45
  • Hmm... I've enabled Java Access Bridge (JAB) too, and I can see elements on Java demo apps with Inspect.exe in UI Automation mode. I need to take a look at some InstallAnywhere example. – Vasily Ryabov Feb 03 '16 at 10:43
  • Just in case. If you use IDLE or other IDE, you probably need to reload Python interpreter after enabling JAB and restarting wizard. – Vasily Ryabov Feb 03 '16 at 10:53
  • Hmm... Not all Java apps are equally accessible by UIA. JavaFX samples look OK, but owner-drawn Java2D and similar samples have no accessibility info. You may ask InstallAnywhere tech support about accessibility features in a wizard. – Vasily Ryabov Feb 03 '16 at 11:20