Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to add test to test set using vb script ?
#1
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
#2
hi,

Code:
set qtpapp=CreateObject("Quicktest.Application") qtpapp.Open "c:abc\test1" qtpapp.Visible=True qtpapp.Test Run qtpapp.Quit set qtpapp=Nothing

write the code in any text file save the file with .vbs and run the file by double clicking on it.
this code with run the mentioned test in the path above and close the qtp after execution.
Reply
#3
@HI Amit,

The question was about the QC OTA(Open Test Architecture) and not about the AOM(Automation Object Model).

@dasappa:I would suggest you to go thru OTA API reference file once, hope you can get the solution with that.
Reply
#4
Did you get a reply to this?

One question where did GetTest() come from?
Set NewTest = GetTest("C-BR1-FR10-TC1", "Subject\CWF_Regression")

I just want to simply add a test to a test set... cannot find anywhere including in Documentation...

LB
Reply
#5
I'm also facing the same issue, can you please assist with codes for adding tests in the test instance.

Thanks,
Sunnhy

If anyone has solution for this, please share it.

Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Moving Test Resource(ALM) to other Folder Bastian-31 0 2,099 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,502 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 4,200 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,869 05-17-2016, 10:48 AM
Last Post: amit25007
  Test Set Run automatically Santhosh311 0 2,782 04-14-2016, 06:06 PM
Last Post: Santhosh311

Forum Jump:


Users browsing this thread: 1 Guest(s)