Bulkan Evcimen

Running QTP tests using Python

QTP provides an interface called the automation object model. This model is essentially a COM interface providing a bunch of objects that can be used to automate QTP. The full object list is available in the QuickTest Professional Automation documentation.

Running QTP tests from the command line is useful for doing scheduled automatic testing. If you use a continuous integration system to do automatic builds of your software, you can run your QTP tests on the latest build.

The following is a Python script that is able to run a test and print out Passed or Failed. It is a direct port of example code in the documentation written in VBScript

Comments

Amit - 2011-10-14 11:35:10
Hi there, I have installed teh Quick Test Add-in. but still I get this error, >>> qtp = win32com.client.Dispatch("QuickTest.Application") Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 104, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 84, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Invalid class string', None, None) Any help?

Bulkan Evcimen - 2011-10-15 23:43:54
Hi, It looks like the QTP COM object is not available. Are you running your script on a machine that has the QuickTest.Application COM object ?

Post a comment

a,b tags are allowed, rest are stripped
Email wont be spammed.I promise

CSS Layout by Rambling Soul