Hello friends - This is awesome post, I really learned a lot by just reading some of the posts. In the nutshell, we bought QC and we already have QTP in place.

I read example in QTP where it automatically enters defect in QC, here is that example:

Dim QCConnection

Set QCConnection = QCUtil.QCConnection

'Get the IBugFactory

Set BugFactory = QCConnection.BugFactory

'Add a new, empty defect

Set Bug = BugFactory.AddItem (Nothing)

'Enter values for required fields

Bug.Status = "New"

Bug.Summary = "New defect"

Bug.DetectedBy = "admin" ' user that must exist in the database's user list

'Post the bug to the database ( commit )


How would I write a code in QTP which will automatically open Tests from Test Lab(QC) and run it and if it fails then it will log defect in QC?

Thanks in Advance