Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to add test to test set using vb script ?
#1
Not Solved
I was able to add test set but not able to add the test in QC. I would really appreciate if some one could help me on this issue. Below is the code I was trying to use. Please let me know if anyone need more inofrmation.


Code:
qcServer ="servername"

Set tdc = CreateObject("TDAPIOLE80.TDConnection")
If (tdc Is Nothing) Then
    MsgBox "tdc empty"
Else
    Msgbox "Connection object created"
End If

tdc.InitConnectionEx qcServer
tdc.Login "testlogin", "testpassword"
tdc.Connect "domain", "project"

    Set TreeMgr = tdc.TreeManager
    Set testF = tdc.TestFactory
    Set labTreeMgr = tdc.TestSetTreeManager


'-----------------------------------------
' Test Lab
'------------------------------------------
Code:
' Get or create a test set folder.
    errmsg = "Lab node error"
    Dim tsFolder, tsFolderPath
    tsFolder ="CWF_Regression"
    tsFolderPath = "Root\" & tsFolder
    On Error Resume Next
    Set labFolder = labTreeMgr.NodeByPath(tsFolderPath)
  '  On Error  GoTo LinkDefectsToEntitiesErr
    If labFolder Is Nothing Then
        Set labTreeRoot = labTreeMgr.Root
        Set labFolder = labTreeRoot.AddNode(tsFolder)
        labTreeRoot.Post
        msgbox "Folder Created in TestLab"
    Else
    Set labTreeRoot = labTreeMgr.Root
        Set labFolder = labTreeRoot.AddNode(tsFolder)
        labTreeRoot.Post
        msgbox "unable to create folder in test lab"
    End If

' Get or create a test set from the factory of the new folder.
    errmsg = "Test set error"
    Dim tsName
    TestName = "CWF_Regression"
    tsName = TestName
    Set testSetF = labFolder.TestSetFactory
    Set aFilter = testSetF.Filter
    aFilter.Filter("CY_CYCLE") = tsName
    Set lst = testSetF.NewList(aFilter.Text)
    If lst.Count = 0 Then
        Set TstSet = testSetF.AddItem(Null)
        TstSet.Field("CY_CYCLE") = tsName
        TstSet.Post
    Else
        Set TstSet = lst.Item(1)
    End If

' Get or create a test instance from the factory of the new test set.

Set NewTest = GetTest("C-BR1-FR10-TC1", "Subject\CWF_Regression")
msgbox   NewTest.ID

    Set NewTest = testF.AddItem(Null)
     NewTest.Name = "C-BR1-FR10-TC1"
     msgbox NewTest.ID

    errmsg = "Test instance error"
    Set testInstanceF = TstSet.TSTestFactory
    Set aFilter = testInstanceF.Filter
    aFilter.Filter("TC_TEST_ID") =    NewTest.ID   '"C-BR6-FR28-TC19"  
    Set lst = testInstanceF.NewList(aFilter.Text)
    If lst.Count = 0 Then
        Set tstInstance = testInstanceF.AddItem(Null)
    ' Put the new test in the test set.
        tstInstance.Field("TC_TEST_ID") =    NewTest.ID    '"C-BR6-FR28-TC19"  
    
    Else
        Set tstInstance = lst.Item(1)
    End If
    tstInstance.Status ="FAILED"
Reply


Messages In This Thread
how to add test to test set using vb script ? - by dasappa - 12-02-2010, 12:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Moving Test Resource(ALM) to other Folder Bastian-31 0 1,660 09-18-2017, 12:24 PM
Last Post: Bastian-31
  Can we integrate HP UFT with VSTS Test Manager or Sandpit Version rodgernadal 0 2,123 06-07-2017, 02:18 PM
Last Post: rodgernadal
  [UFT 12.52/VBScript] Test object exist, is visible and enabled before take an action sparkwanted 0 3,641 02-07-2017, 12:28 AM
Last Post: sparkwanted
  How to run multiple iterations only on a set of lines in script amit25007 0 2,448 05-17-2016, 10:48 AM
Last Post: amit25007
  Test Set Run automatically Santhosh311 0 2,428 04-14-2016, 06:06 PM
Last Post: Santhosh311

Forum Jump:


Users browsing this thread: 3 Guest(s)