Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: How to update test step status in QC using QTP script?

$
0
0

    Dim runStepList
    Dim CurrentRun ' object which holds the current run

'=============================================================================================
'@purpose- this function will copy design steps from 'design steps' tab to current run of test in QC
'make sure qtp and qc connection has been established before runnning the test
'=============================================================================================
Function CopyDesingSteps()
    Onerrorresumenext
    Dim otest
    if QCUtil.IsConnected =Falsethen
    msgbox"Please establish connection to ALM first."
        'ExitAction
        Exitfunction
    
    Endif
    set CurrentRun = QCUtil.CurrentRun
    
    ' copy design steps to current run

      CurrentRun.CopyDesignSteps

     GetDesignSteps  CurrentRun

    intTotalNumberOfUpdatedSteps=0
    
EndFunction



'=============================================================================================
'@ purpose- this function will retrive  the list of steps of current run in to runStepList
'=============================================================================================
Function GetDesignSteps(CurrentRun)
    'On error resume next
    Dim intStepcount
    Set runStepF = CurrentRun.StepFactory

    Set runStepList = runStepF.NewList("")
        intTotalNumberOfSteps=runStepList.Count
    For intStepcount = 1To runStepList.Count
        runStepList.Item(intStepcount).Field("ST_STATUS") ="Not Completed"
        runStepList.Item(intStepcount).Field("ST_ACTUAL") ="Not Completed"
        runStepList.Post
        
    Next
    
    Set runStepF = nothing               
EndFunction
'=============================================================================================
'@purpose- This function will update specified step with status and actual in test run result
'=============================================================================================
Function UpdateStep(byval stepID,byval strStatus,byval strData)
    'On error resume next

        If strStatus = TrueThen
            strStatus="Passed"
        '
        else
        strStatus="Failed"
        
        EndIf
        ' update step status and step actuals
        runStepList.Item(stepID).Field("ST_STATUS") =strStatus
        runStepList.Item(stepID).Field("ST_ACTUAL") =strData
        runStepList.Post
        
EndFunction

Sub EndTest()
    CurrentRun.Post
    Set runStepList= nothing
    Set Currentrun = nothing

endSub
Sub BeginTest()
     ' copy design steps to current run
 CopyDesingSteps 

EndSub

 

 

In qtp script at the start call BeginTest() function then use UpdateStep to update each step and at the end use EndTest to post result in qc


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>