user1724956
user1724956

Reputation: 75

Running the test cases in ALM 12.01 version using groovy script

I am working on updating the test results in test lab of ALM 12.01 version from soapui pro.so i am doing this through groovy scripting. I can now filter the test case and make it passed or failed,but could not do the same for test steps.have used step factory to get the count of nodes. but i have no idea of using run factory for updating each field in test step like 'status','actual results'.below is the part of code i m stuck with.

// Create a new Test Run newRun= tsfact.RunFactory.AddItem('Run_Auto')

newRun.Status = 'Passed'
newRun.Post()
newRun.CopyDesignSteps()
newRun.Post()

//  Populate Auto Run Test step Data
tsSteps = newRun.StepFactory.NewList("")
log.info tsSteps.count()
for(tsStep in tsSteps)
{


tsStep.Status = 'Passed'

}

Upvotes: 0

Views: 344

Answers (1)

Lerminou
Lerminou

Reputation: 199

My script is from the opposite side but i think it should work. I run soapui test from ALM 11. There is my vb script to populate ALM teststeps from soap ui teststep.

For each step, i call this function, juste replace my stepFactory currentRun by your variable newRun

Sub addRunData(CurrentRun, sStepName, sStatus, sDescription, sExpected, sActual )

    Dim objRun
    Set objRun = CurrentRun
    //Create Step object and add values to Object array
    Set objStep = objRun.StepFactory.AddItem(null)
    objStep.Field("ST_STEP_NAME")= sStepName
    objStep.Field("ST_STATUS") = sStatus
    objStep.Field("ST_DESCRIPTION") = sDescription
    objStep.Field("ST_EXPECTED") = sExpected
    objStep.Field("ST_ACTUAL") = sActual
    objStep.Post
    Set objStep = Nothing
end sub

You can insert expected and actual value with assertions or messages from your request for example

Upvotes: 0

Related Questions