Eva Hernandez G Absent Member.
Absent Member.
148 views

QTP and Quality Center

I want to create defetcs in the Quality center, but i need to create them with more explanation.
I know the option in QTP, in Options, Run tab; Submit a defetc to Quality Center for each failed step. When i check the defect are all the defetcs identically.
Is it possible to create a defect via vbscript?
0 Likes
5 Replies
Knowledge Partner
Knowledge Partner

Re: QTP and Quality Center

You can use the QCUtil object from your QTP script - that gives you access to everything in the OTA API. You can create defects, runs and all other kinds of objects.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Knowledge Partner
Knowledge Partner

Re: QTP and Quality Center

You can use the QCUtil object from your QTP script - that gives you access to everything in the OTA API. You can create defects, runs and all other kinds of objects.

Jan Czajkowski
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
GeorgesMarselus Absent Member.
Absent Member.

Re: QTP and Quality Center

Hi Eva,

Here's some actual code you can use. One thing to keep in mind when creating defects from QTP is possible duplicate defects being (unless you have a way of checking if it already exists). Anyway, here is the code...

FYI: Of course you would populate the fields you find relevant...

'Create connection
Dim QCConnection
Set QCConnection = QCUtil.QCConnection
Set BugFactory = QCConnection.BugFactory

'Add a new, empty defect
Set bug = BugFactory.AddItem (Nothing)

bug.field("BG_SUMMARY") = defect_summary '"test adding a new defect from QTP as well as automatic e-mail functionality"
bug.field ("BG_STATUS") = "New" '--Default
bug.field ("BG_DETECTED_BY") = detected_by
bug.field ("BG_DETECTION_DATE") = date() 'Default to current date
bug.field ("BG_DESCRIPTION") = "Requirement = '"&req&"' - "&defect_desc'"This is a test entry from automation, QuickTest Pro. The actual result did not meet the expected result. The Analyst, Developer (Assigned To person) and Tester (Deteted By person) should get an email of this defect automatically."
bug.field ("BG_RESPONSIBLE") = assign_to '"georgeslauture" 'Assigned To field

'These are user defined fields
bug.field ("BG_USER_02") = analyst'Analyst field
bug.field ("BG_USER_04") = "Testing" 'Introduced By field -- DEFAULT
bug.field ("BG_USER_05") = req'Requirements field
bug.field ("BG_USER_03") ="Automation" 'Found In field - 'Default
'install_date = DateAdd("d",30,date())
bug.field ("BG_USER_06") = install_date 'Install Date field
bug.Post 'commit to creating defect

'Clean and and release resources
Set BugFactory = Nothing
Set bug = Nothing

Hope this helps,
Thanks,
Georges
0 Likes
Highlighted
DRE_3 Absent Member.
Absent Member.

Re: QTP and Quality Center

Hey. Where can you find the complete list of "Properties".

Ex.

BG_STATUS
BG_PROJECT

etc...
0 Likes
GeorgesMarselus Absent Member.
Absent Member.

Re: QTP and Quality Center

Hi,
I think by properties you mean 'fields' for the project (i.e. BG_Status, etc). If so, the easiest way is probably to go into the Customization in the project in Quality Center. Once there, you can go go the Entties. This will tell you all of the fields and their dbase name.

Let me know if you have any more questions.

Thanks,
Georges
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.