Select Page
QA Automation

QC Test Lab results update using OTA

The below OTA code creates a run for a test and steps for it. This is very helpful to upload your local execution results to QC at any time.

Dim tdc, qcServer
Dim qcUsername,qcPassword,qcDomain,qcProject
Dim vPath,oTestSet,oTest,oRunInstance,oRun,oStep,oStepDetails

Set tdc = CreateObject("TDApiOle80.TDConnection")
qcServer = "URL"'QC URL
tdc.InitConnectionEx qcServer

qcUsername = "Your Username" 'Username
qcPassword = "Your Password"   'Password
tdc.Login qcUsername, qcPassword

qcDomain = "Domain" 'QC Domain Name
qcProject = "Project" 'QC Project Name

tdc.Connect qcDomain, qcProject

vPath="RootAutomationScripts" 'Path to the folder contains test sets

'Selecting first Test-Set
Set oTestSet = tdc.TestSetTreeManager.NodeByPath(vpath).TestSetFactory.NewList("").Item(1).TsTestFactory

'Selecting first Test from Testset
Set oTest = oTestSet.NewList("").Item(1)

'Creating a Run
Set oRunInstance = oTest.RunFactory
Set oRun=oRunInstance.AddItem("Automated")'Run Name

oRun.Status = "Passed"'Run Status
oRun.Post   
oRun.Refresh

Set oStep = oRun.StepFactory
oStep.AddItem("Sample Step")'Creating Step
Set oStepDetails = oStep.NewList("")
oStepDetails.Item(1).Field("ST_STATUS") = "PASSED"'Updating Step Status
oStepDetails.Item(1).Field("ST_DESCRIPTION") = "Test Desc"'Updating Step Description
oStepDetails.Item(1).Field("ST_EXPECTED") = "Test Expected"'Updating Expected
oStepDetails.Item(1).Field("ST_ACTUAL") = "Test Actual"'Updating Actual
oStepDetails.Post

Set oStep=Nothing
Set oStepDetails=Nothing
Set oRun=Nothing
Set oRunInstance=Nothing
Set oTest=Nothing
Set oTestSet=Nothing
Set tdc=Nothing
  

Comments(0)

Submit a Comment

Your email address will not be published. Required fields are marked *

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility