Tool Review: PAMIE
4. Februar 2011 Hinterlasse einen Kommentar
Tool Review: PAMIE
PAMIE (Python Automation Module for I. E.) is a library, which enables Python to interact with Internet Explorer. PAMIE automates the browser by manipulating the Document Object Model (DOM) via the COM interface. PAMIE is used to create web tests written in Python using Microsoft Internet Explorer.
The review is focused on PAMIE 3.0.
- Neither the browser nor the displayed web site/web application gets changed to enable interaction.
- The native interaction enables PAMIE to read many details of the current state of the browser. For example PAMIE is able to synchronize the test with the browser.
A documentation of PAMIE is barely available. The development for cPAMIE 2.0 stopped in 2006. So does the main project page http://pamie.sourceforge.net/. There is no information provided. Mostly you read “UNDER CONSTRUCTION!!“. The only way to get help is to search the Internet or look inside the source of the PAM30.py library which is actually good documented.
Support is provided through a forum on sourceforge. The user “rmarchetti” (Rob Marchetti) is answering questions. He is also the developer.
The installation of PAMIE can be quite tricky for a Python newbie. Although if you get the right files, it is pretty simple and straight forward. You should start with the basic Python installation found on the download page of the Python project. Download and install version 3.x to use PAMIE 3.0. Once installed, download and install the PyWin package (PAMIE uses this 3rd party windows extension library). If you download the version packed with the installer (pywin32-214.win32-py3.1.exe), the libraries will automatically get compiled and copied to the right Python folder. Then download the latest version of the PAMIE 3.x library from sourceforge and copy the two .py files (PAM30.py and winGuiAuto.py) into the folder “site-packages” of your Python installation. Now everything should be set up correctly to use PAMIE inside your Python scripts by importing the library.
Important: although you can often find “from cPAMIE import PAMIE” on the Internet you have to import PAMIE 3.0 by using “from PAM30 import PAMIE”.
Handling & Usability:
The way you develop your test scripts is up to you, because PAMIE as a library does not need a specific IDE or editor. You can use every editor you like (e.g. notepad.exe) or use your favorite IDE if a Python plugin exists (e.g. Python Plugin for Eclipse). I tried a simple but powerful Python IDE named PyScripter.
After the decision which IDE to use you can start to create your first test. PAMIE itself does not provide any further help creating tests except the method writeAttrs(). This method prints out every available input element on the current website (textfields, checkboxes, buttons, …), so you know exactly which elements can be automated with PAMIE (links are note listed by the method but PAMIE is able to click them of course).
Just like WatiN, your main automation object is the PAMIE object. With that you can manipulate the browser by navigating to a specific URL or clicking different links or elements of the website. So the API is very limited and focuses on the most important interaction methods. On one hand the limited functionality of PAMIE could lead to use cases which can not be implemented. But on the other hand the simplicity makes it easy for newcomers and non-developers to write tests using PAMIE and Python.
Page synchronization is automatically done with a default timeout of 300 seconds. PAMIE highlights elements, you are interacting with, or when you read the current value of an element of the website or by using one of PAMIEs findXXX() methods.
PAMIE on its own does only provide functionality to interact with Internet Explorer, so data-driven-testing is of course not supported out of the box. Since PAMIE is based on Pythonm, data-driven-testing could be implemented. Furthermore with PyUnit it is possible to integrate the tests in a Unit Test environment.
It is not possible to find an official compatibility matrix of PAMIE, but after some small tests using IE6 and IE8 it looks like all major versions of Internet Explorer are supported at the moment.
PAMIE is designed to create web test with Python using Internet Explorer and it fits this purpose. Although I would suggest other tools when web tests get a bit more complex or more browsers than Internet Explorer should be supported. If you know Python very well then stick to PAMIE, if not grab another tool.
About the Author
Klemens Loschy is member of SEQIS – The Austrian Test Experts! since 2002 and is responsible for test automation, load & performance tests, test frameworks and test tool development. Furthermore he is a student at the Technical University of Vienna (Software Engineering). He has more than 9 years experience with all kind of test software (automation and management) and programming languages (Java, SenseTalk, TSL, …).
Feel free to conctact him: firstname.lastname@example.org