automating GUI tasks in Python
I have a program which is an example of usability nightmare. It's easier to create data in Excel and somehow migrate them to that program. Unfortunately, the only access to data is through GUI.
Well, I decided to find some automation tool for GUI testing, with Python as a scripting language. The need of Python is essential, because I don't want to learn yet another scripting language, especially if it is claimed to be user-friendly.
The first try was TestComplete, but the license costs too much for me ($600), therefore I didn't even consider it. Then I skipped several tools because of unknown scripting languages. Finally, I found something promising: Ranorex.
I can't say I'm very impressed. It took a lot of time to make a test script working.
Ranorex doesn't distribute binaries for Python 2.5, I failed to make Ranorex to work with Python 2.3, therefore I had to install Python 2.4 and find the installation instructions in the forum. Fortunately, it helped.
The second problem is that in some cases the documentation differs from the reality. Fortunately, not too much.
The test scripts don't work with Calculator from Windows 2000.
But I understand that the program is very new and Python isn't the main priority of the developers, therefore I don't blame anyone. Ranorex is quite good for the version 1.0.
Meanwhile, here is a test script I wrote. It finds a Calculator windows, presses the buttons "2", "*", "7", "=", and checks that the result is as expected.
import RanorexPython as Ranorex
def a(val):
assert val
assert val != 0
# Find the calculator
form = Ranorex.FormFindTitle("Calculator", Ranorex.MATCH_EXACT, 1, 5000)
a(form)
# Press the buttons "2" "*" "7" "="
for id in [126, 91, 131, 112]:
button = Ranorex.FormFindChildControlId(form, id)
a(button)
a(Ranorex.ButtonClick(button))
# Get the expected result
result = Ranorex.FormFindChildControlId(form, 403)
a(result)
s = Ranorex.ControlGetText(result)
assert("14, " == s)