Highlighted
Contributor.
Contributor.
1082 views

QC-QTP INTEGRATION QUESTION

Jump to solution

Hello,

 

I want to query against QC database from QTP. After I connect to QC, how do I run the select query from DESSTEPS table?

 

tdc.Connect qcDomain, qcProject    ///this line does connects to QC

mySQL = "Select  *  from DESSTEOS  WHERE DS_TEST_ID = '22561' "

 I am not getting any data. Any help?

 

Thanks.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

Project DB Reference can be saved with .chm extension. I get blank content. Can I save it as pdf or word? if not, how to open .chm file? Just double clicking this file gives me blank content but I can see the table of contents.

View solution in original post

0 Likes
23 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

You are essentially connecting to the project using the QC OTA API. To execute a SQL query through such a connection you will have to use the Command object of the QC OTA API. Refer to the QC Open Test Architecture API reference document for complete details on using this object.

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

From QTP, after I get connected to QC, I have something like this:

 

Set ComObj = tdc.command

 

 

I get error as "You do not have permission to create commond object.....".

 

I am not admin. What role do I need in QC?

Does the admin need to do special setting for me to create a commond object?

 

Thanks.

 

-Safi

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: QC-QTP INTEGRATION QUESTION

Jump to solution
As stated in the API reference for the Command object:

Because of the risk, use of the Command object is restricted. For information about security and rights to use the Command object, refer to the HP ALM Administrator Guide.

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

Thanks. I was able get it working. I got the admin right.

 

    com.CommandText = "select DS from DESSTEPS WHERE DS_TEST_ID = '22553' "
msgbox RecSet.FieldValue("DS_EXPECTED")

 I am getting the data in the html format from the data base. QC > DESSTEPS> DS_EXPECTED has "ADD TWO PLUS TWO". But I am getting it as "

<html>

<body>

<div align="left"><font face="Arial"><span style="font-size:8pt">ADD TWO PLUS TWO</span></font></div>

</body>

</html>

Do you know why I am getting the data from the QC DB as html format?

0 Likes
Highlighted
Established Member..
Established Member..

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

A lot of text data is stored in the DB as Html.  You could use the IgnoreHtmlFormat property of the TDConnection object to access the DesignStep data, instead of using  SQL via the Command object.   Using SQL, you get exactly what's in the DB.

0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

I am not sure how and where I would enter the ignorehtmlformat property. Could you please provide some example?

0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution
RecSet.FieldValue("DS_TEST_ID")

 

 

I have this code which returns with html tags. How can I add ignorehtmlformat to this ?

 

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

You can't use the IgnoreHtmlFormat option if you are retrieving the data by executing a SQL query through the Command object.

 

Instead, you would use the option thus by inserting a line like this:

tdc.IgnoreHtmlFormat = True

 Then you would use the DesignStepFactory object NewList method to retrieve a list of DesignStep objects that are the design steps for the specified test. To access the DS_EXPECTED value for each step, you would cycle through the list and get the value from the StepExpectedResult property of the DesignStep object.

DesignStepList(index).StepExpectedResult.

 

 

There are examples of how to use the NewList method for various Factory objects in the QC OTA API. There is not sample code specifically for retrieving Design Steps, but you should be able to extrapolate from the other available examples.

 

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution
Set tdc = CreateObject("TDApiOle80.TDConnection")  
……………
………….
Set com = tdc.Command
com.commandtext = "select DS_EXPECTED, DS_ID from DESSTEPS WHERE DS_TEST_ID = '22553' "
   Set RecSet = com.Execute
   ColCnt = RecSet.ColCount
    RecCnt = RecSet.RecordCount
    For i = 0 To RecCnt-1
		MSGBOX   RecSet.FieldValue("DS_EXPECTED")  & ", " &RecSet.FieldValue("DS_ID") 
tdc.IgnoreHtmlFormat = True
       		 MYEXPECTED = RecSet.FieldValue("DS_EXPECTED")
tdc.IgnoreHtmlFormat = True
		msgbox MYEXPECTED
		RecSet.NEXT
    Next

 Since I already started using the SQL, i would like to continue for this exercise. I think I got all except that I am getting the html tags. I am lost. I spent a lot of time. Can you please take a look and see why am i still getting the html tags for the MYEXPECTED variable?

0 Likes
Highlighted
Established Member..
Established Member..

Re: QC-QTP INTEGRATION QUESTION

Jump to solution

As Trudy and I said, all data accessed from the db comes as is, ie. if it is stored in the db as html, then that is what you get using a SQL command.  The conversion to plain text is then up to you.  You already started using the TDConnection object.  The tdc.IgnoreHtmlFormat property has no affect on the tdc.command object.

 

Just continue to use tdc to access the DesignStepFactory as Trudy explained.  Passing SQL commands via the Command object is very risky - one slip of a keystroke and you could delete your entire database.  It is much better and safer to access QC data via the factory object model.

 

It is possible to parse html to extract the text.  Have a look here for instance, or search on html parser.

0 Likes
Highlighted
Contributor.
Contributor.

Re: QC-QTP INTEGRATION QUESTION

Jump to solution
Set TestF = tdc.DesignStepFactory
Set TestList = TestF.NewList(" ")

  For Each TestPlan In TestList
   MY_ID = TestPlan.Field("DS_TEST_ID")
   MSGBOX MY_ID
 Next

 i was expecting MY_ID should have the value but gets nothing. It is not giving me error. It is also not reaching the msgbox.

I am looking WHERE DS_TEST_ID = '22553'. How would I specify this into NewList method?

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.