[Israel.pm] Accessing Quality Center by Perl
Amir E. Aharoni
amir.aharoni at gmail.com
Thu Dec 13 14:40:15 PST 2007
On 28/11/2007, Gabor Szabo <szabgab at gmail.com> wrote:
> I am facing the challenge of accessing the once Mercury now HP
> Quality Center by Perl.
> Does anyone here know if they have an API do so?
I used to work at a company which is a very heavy user of TestDirector
(now called Quality Center). There was a whole team of people that
managed the Mercury database - like IT managers, but for TestDirector
Executive summary: Think twice before getting into such a project,
unless you have a TD expert nearby. I had full-time TD experts to help
me - without them i wouldn't go far, because Mercury's documentation
is very unhelpful.
The boring details:
I had to develop a solution for synchronizing different testing
databases. I thought of doing it in Perl (i always think of doing
everything in Perl first). Well - there are two problems:
1. This whole TD product is strongly Microsoft-centric -
OLE/ActiveX/COM. Perl supports OLE, but the program has to run on
2. This problem is even worse: The API is ... not so good. You have to
jump through ridiculous hoops to just get a field of a test record
(like - what is the expected result for test X?)
Now - Perl's OO system doesn't map to OLE so well, unless you know
what you are doing really well. In simple cases, such as Office
scripting (writing VBA-like macros in Perl) it works pretty well, but
with weird API's such as TD it is very bad. One example i can think of
is error checking - you can call a nonexistent function without ever
noticing. And in the TD API you're never really sure which function
you want to call. It has this weird methods such as
TDOLEAPI.TDList.ListFactory for everything (maybe they went too far
with design patterns...)
Eventually i gave up and did the part that connects to TD in VB.NET,
saved the output to files and processed it with Perl.
Another - possibly more portable - solution is to write it all in SQL.
There's an SQL database inside TD (Oracle or MS-SQL server - i don't
remember; maybe both can be used.) Some people who use TD become so
good at it, that they prefer to use SQL directly to get information
instead of that weird API, even though the columns have lovely
semi-randomly generated names such as HGERFG09.
More information about the Perl