09-07-2011, 09:47 AM
Hi,
To execute a particular test, use below code;
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
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