Functional test web site using python com and Internet Explorer

C

Chris Cottee

Hi,
I am trying to extend PAMIE (sourceforge project to functionally
test web sites using com and python) and I wondered if anyone had done
this sort of thing before and had any pointers. My main reason for
doing this is that the website I want to test is so full of frames and
javascript that it seems painful to try to fix httpunit to be able to
cope with it. The difficulties I am having are in getting IE to behave
repeatably, handling multiple levels of frames and handling events. In
particular when I use dispatchWithEvents instead of Dispatch the IE6
gui almost seems to block (it gets much slower at any rate). Is this
to be expected ? I have used pythoncom._GetInterfaceCount() to see if
I was getting loads of references but I only have 2.

Thanks,
Chris
 
J

John J. Lee

particular when I use dispatchWithEvents instead of Dispatch the IE6
gui almost seems to block (it gets much slower at any rate). Is this
to be expected ? I have used pythoncom._GetInterfaceCount() to see if
I was getting loads of references but I only have 2.
[...]

Dunno. Try the python-win32 list.

(URL typed in by hand -- anyone know how to cut-n-paste on X when your
mouse is injured??)

http://mail.python.org/mailman/listinfo/python-win32


I hesistate a *little* (but not too much) to suggest this, because the
thing really is a pile of junk, but the IOpus "Internet Macros"
product does IE macro recording / playback. Recording 'macros' like
this (using IE as normal + a little help from a sidebar and popup
windows) is very convenient. There is a COM IDispatch interface that
just-about works for running recorded macros. It's cheap. There is
an ugly-but-serviceable declarative language in which the macros are
recorded. I've used it to test an application involving lots of
JavaScript. It would be perfect for functional testing if only the
people who wrote it paid a little more attention to implementation
quality. For example, you can't single-step through a macro to debug
your application when a test fails. Painful. The 'little language'
in which macros are recorded is ugly and has weird arbitrary
restrictions -- and the same goes for the rest of the app. The docs
are not great. I had one test fail non-reproducibly (failed
spuriously when run with other failing tests all launched from the
same Python process, passed when run invididually or when run with
other non-failing tests). Luckily, the restrictions don't actually
get in the way (so far, anyway). It does (just barely!) get the job
done: apart from the issue I mention above, the problems I've seen
with it so far are all to do with ease of use rather than correctness
of tests. Well, apart from the fact that the scripts it records
really *are* just scripts, not programs with conditional logic &c, so
you can't factor out duplicated test logic, and it rather discourages
writing non-trivial tests, which limits its effectiveness. Also, it's
IE-only and Windows-only: testing against IE/win is necessary but not
really fully sufficient for a lot of people.

Vapourware: before I noticed the IOpus thing, I had the idea of doing
something very similar: using a plugin and a sidebar in IE to function
as a 'macro recorder', but with cross-browser playback (maybe even
cross-browser recording too), using Python instead of a "little
language" to record scripts, (which would do double-duty as a nice
Python API to control IE), etc. Suffering the IOpus product,
just-about-useable though it is, has revived my interest in the
project ;-)


John
 
C

Chris Cottee

Cheers for your help John,
I'd forgotten to look at that mailing list so I've trawled the
archives and posted a question their as well. I've had a look at that
Internet Macro tool you mentioned and it is very close to what I would
like except that of course it is not open so I can't change it. My
guess is that it is implemented using COM and Internet Explorer which
would be encouraging since it would mean that what I am trying to do
would work.

Yours optimistically,

Chris
 
M

MarcSchwarz

Hi,

I am using Internet Macros for almost a year now. I highly recommend
it:
For example, you can't single-step through a macro to debug
your application when a test fails. Painful.

I agree. An acceptable workaround is the "Pause" and "Continue"
feature.

IMHO the best approach is to split the testing in many smaller macros
and use the scripting interface to connect them (see below).
Well, apart from the fact that the scripts it records
really *are* just scripts, not programs with conditional logic &c, so
you can't factor out duplicated test logic, and it rather discourages
writing non-trivial tests, which limits its effectiveness.

While the macros itself are only good for simple testing, the
"Scripting Interface" makes the app extremly powerful. It allows you
to remote control the Internet Macros browser from *any* Windows
programming language. While I use mostly VB and Perl, you could use
Phyton as well (http://www.iopus.com/iim/tutorials/python.htm )

This approach allows me to store the web test results directly in a
database and use any kind of conditional logic, e.g

return = iimPlay ("macro-test1")
if return < 0
'Test1 failed!
return = iimPlay ("do-something")
else
return = iimPlay ("macro-test2")
end if

(iimPlay is a command provided by Internet Macros, it starts the IM
browser and runs a macro.)

I used this approach to automate extensive web testing for several
banks and insurance companies. So far, my clients love it ;-)
Also, it's
IE-only and Windows-only: testing against IE/win is necessary but not
really fully sufficient for a lot of people.

I agree. But I heard they are planning support for Mozilla / Firefox
later this year. In general, I found their support *very* responsive
whenever I had a problem with the software.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top