Monday, November 29, 2010

Raise the defect from QTP

Dim TDConnection


Set TDConnection = CreateObject("TDApiOle80.TDConnection")

TDConnection.InitConnection "http://10.128.76.242:8080/qcbin" ' URL for the DB

TDConnection.ConnectProjectEx "DomainName","ProjectName","UserName","Password "

If TDConnection.Connected Then

MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName + chr (13) +"Project " + TDConnection.ProjectName )

'Get the IBugFactory

Set BugFactory = TDConnection.BugFactory

'Add a new empty bug

Set Bug = BugFactory.AddItem (Nothing)

Bug.field ("BG_STATUS") = "New"

' BG_RESPONSIBLE

Bug.field ("BG_PROJECT") = "Testing"

Bug.field ("BG_SUBJECT") = "Automation Testing"

Bug.field ("BG_SUMMARY") = "Automation Testing"

Bug.field ("BG_DESCRIPTION") = "QTP create the Defect Log for Automation Testing"

' BG_DEV_COMMENTS

Bug.field ("BG_SEVERITY") = "Severity 4"

Bug.field ("BG_PRIORITY") = "Low"

Bug.field ("BG_DETECTED_BY") = "UserNAme"

Bug.field ("BG_USER_01") = "Raised"

Bug.field ("BG_USER_02") = "Cycle 0"

Bug.field ("BG_USER_06") = ""

Bug.field ("BG_USER_09") = "1375484"

Bug.field ("BG_USER_10") = "SIT"

Bug.field ("BG_USER_11") = "Automation"

Bug.field ("BG_USER_12") = "Others"

Bug.field ("BG_USER_15") = "IN"

Bug.Post

Else

MsgBox("Not Connected")

End If

3 comments:

Anonymous said...

nice work yar

Anonymous said...

hi, i too working on something similar, the hard coded values will work with qc bugfactory fields but have you tried with data table values.getting an error like "can't post the bug"

any suggestions.

Bug. Field("BG_STATUS")=”Open” Will work
Bug. Field("BG_STATUS")=datatable.Value("DefectStatus", "dDefects")Not working

Anonymous said...

I am creating a defect using OTA. I need a VBS or QTP script to link this defect to a test case. Can somebody help me here.
Kishore