Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Execute a testset from QC using OTA framework
#4
Not Solved
Hi,

To execute a particular test, use below code;

Code:
Dim tdc
Dim runName
Set tdc = CreateObject("TDAPIOLE80.TDConnection")

'###############################################################################​################################
tdc.InitConnectionEx "http://qctest:8080/qcbin"
tdc.Login "automation", ""
tdc.Connect "STD", "Project"

If (tdc.connected <> True) Then
MsgBox "qc project failed to connect to " &"Project"
WScript.Quit
End If

Set tfact = tdc.TestSetFactory
Set tsTreeMgr = tdc.TestSetTreeManager
Set tcTreeMgr = tdc.TreeManager
nPath = "Root\" & Trim("Bui\testset")
Set TestSetFolder = tsTreeMgr.NodeByPath(npath)

Set TestSetF = TestSetFolder.TestSetFactory 'Retreive test from given folder in test lab
Set aTestSetArray = TestSetF.NewList("")
tsSet_cnt=aTestSetArray.Count
For i=1 to tsSet_cnt ' Loop through the Test Sets to pick the desired test Set
Set tstests=aTestSetArray.Item(i)
TestSet_Name=tstests.Name
PRINT TestSet_Name
If TestSet_Name= "Creategmailaccount" Then
Flag=1
Set TestCaseF = tstests.TSTestFactory 'Retreive Test Cases from the test set
                           Set aTestCaseArray = TestCaseF.NewList("")
test_qc_cnt=aTestCaseArray.count
For n=1 to test_qc_cnt    'Loop through the Test cases in QC to find the same test case as in Excel
                                                                Set  ts_obj=aTestCaseArray.item(n)                                    
                                                                tname_QC=ts_obj.Test.Name
   If Flag=1 Then                                                                              
      runName =ts_obj.RunFactory.UniqueRunName
      Set RunF = ts_obj.RunFactory ' for managing test runs.
     Set theRun = RunF.AddItem(runName)
     theRun.Name =runName 'assign a run name
     theRun.Status =run_status
     theRun.CopyDesignSteps
     theRun.Post
     Flag=0
     End If
Set runStepF = theRun.StepFactory
Set aTestStepArray = runStepF.NewList("")
Set runStepF = theRun.StepFactory
Set aTestStepArray = runStepF.NewList("")
step_cnt=aTestStepArray.Count
For j=1 to step_cnt  ' Loop through steps and update in qc
                                                                                                         Set runStep=aTestStepArray.item(j)
                                                                                                        step_QC=runStep.Name                                          
                                                                                                       runStep.Status ="Passed" 'you can parametrize this value as per your need
                                                                                                       runStep.Post
                                                                                                        Next
End If
Next
Flag=1
Next

I have extracted this code from the one that i used for my scripts and and tried to modify it as per your need. I f you face any issue then let me know.

Regards,
Parminder
Reply


Messages In This Thread
RE: How to Execute a testset from QC using OTA framework - by parminderdhiman84 - 09-07-2011, 09:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Execute button of putton won't be clicke automaticly in UFT (VB) MarUFT 3 2,455 11-21-2016, 04:22 PM
Last Post: Ankur
  Not able to execute script shanthalaAR 0 1,943 06-27-2015, 03:53 AM
Last Post: shanthalaAR
  Is there a possible way to execute sql in QTP using 'WITH' clause shruthic 0 2,992 04-26-2014, 11:42 PM
Last Post: shruthic
  Execute scripts sherst 0 2,836 01-11-2013, 01:46 AM
Last Post: sherst
  execute file rjkmr.aiht 6 4,994 05-16-2012, 03:09 PM
Last Post: rjkmr.aiht

Forum Jump:


Users browsing this thread: 2 Guest(s)