09-07-2011, 12:01 PM
(This post was last modified: 09-07-2011, 12:02 PM by AutomationTester2011.)
Hi,
Thank you for your Response.I modified the below code and tried executing it in QTP.However no luck.It is creating a Unique run name and it is not executing the test.So Need Assistance as i am new to this OTA framework.
Thank you.
Thank you for your Response.I modified the below code and tried executing it in QTP.However no luck.It is creating a Unique run name and it is not executing the test.So Need Assistance as i am new to this OTA framework.
Code:
Dim tdc
Dim runName
Set tdc = CreateObject("TDAPIOLE80.TDConnection")
'###############################################################################################################
tdc.InitConnectionEx "http://qcSERVER: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 tname_QC = "CreateLogin" 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
Next
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
Flag=1
End If
Next
Thank you.