Micro Focus QTP (UFT) Forums

Full Version: QTP and Visual basic
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi ,

I am using QTP 9.2 with vbscript. However I find that certain functions are required that are created in Visual basic.

Could you tell me how to use Visual basic with QTP 9.2 to create a script that can be run ,

Thank you
Sonia
Most of the vbscript functionalities can be used in QTP 9.2, ONe good way to check if a particular function can be used or not is to run a search on it in the QTP help manual.
One reason why you don't get many replies is because you'r questions don't have much details.It is always a good Idea to include examples and details.Helps us to understand your questione better.
Thank you for the reply. I was actually referring to Quality center OTA API functions . I have not yet coded any of them but an example is the Link object function that can link a defect to a test .

Sonia
Hi

Below is the code ...........
Code:
Private Sub LinkBugToStep()
    Dim linkF As LinkFactory
    Dim link As link
    Dim ilink As ILinkable
    Dim bugF As BugFactory
    Dim Bug As Bug
    Dim stepsList As list
    Dim runF As RunFactory
    Dim run1 As Run
    Set runF = tdc.RunFactory
    Set run1 = runF.Item(71)
    Dim stepF As StepFactory
    Dim step1 As Step
    Dim filter As TDFilter
    Dim stepList As list
    Set stepF = run1.StepFactory
    Set filter = stepF.filter
    Set stepsList = filter.NewList
    Set step1 = stepsList.Item(1)
    Set bugF = tdc.BugFactory
    Set Bug = bugF.Item(26)
    Set ilink = step1
   Set linkF = ilink.BugLinkFactory
   Set link = linkF.AddItem(Bug)
   link.Post
    ' Disconnect tdc

End Sub
......................

The above is a sample Visual basic function that I need to integrate with QTP scripting so that when the defect(bug) is created it is also linked to the test that created it .
But since VB script is different .. how can I use this function ?

Thank you
Sonia