Code for QTP and ALM

Source: Internet
Author: User

Function Markcasestatusinalm (Qcserver,qcusername, Qcpassword, Qcdomain, Qcproject, Qctestsetpath, QCTestSetName)

Dim Blnconnect

Set tdconnection = CreateObject ("Tdapiole80.tdconnection")

With Tdconnection
' Create a connection with the QC Server
. Initconnectionex Qcserver

' Login to QC
. Login Qcusername, Qcpassword

' Connect to QC Project
. Connect Qcdomain, Qcproject

End with



Set Tstreemanager = Tdconnection.testsettreemanager
' Return the test set tree node from the specified tree path
Set TSFolder = Tstreemanager.nodebypath (Qctestsetpath)
' Returns the list of test sets contained in the folder that match the specified pattern.
Set tslist = tsfolder.findtestsets (qctestsetname)
If tslist.count = 0 Then

Reporter.reportevent Micfail, "Mark status in ALM", "No Testset in the." & Qctestsetpath
Markcasestatusonalm = False
Else

Isfound = False
For each testset in Tslist
If LCase (testset.name) = LCase (Qctestsetname) Then
Isfound = True
Exit for
End If
Next

' If Qctestsetname was wasn't found then exit.
If not Isfound Then
Reporter.reportevent Micfail, "Mark status in ALM", "Testset" & Qctestsetname & "is not found."
Else
' This enables database to update immediately when the field value changes
Testset.autopost = True
' Tstestfactory manages test instances (Tstest objects) in a test set
Set tstestfactory = testset.tstestfactory

' Tstestfactory.newlist (") creates a list of objects according to the specified filter
For each qttest in Tstestfactory.newlist ("")
' Change Test status to N/a
' We do the ' Ensure all tests has ' not run ' before starting execution
' If the execution errors out, we can keep track of the tests that were not run
Qttest.field ("tc_status") = "N/a"
Qttest.post

Next
For each qttest in Tstestfactory.newlist ("")

' Runfactory manages Run instances
Set runfactory = qttest.runfactory

' Add A new new Run instance.
Runname = Runfactory.uniquerunname
Runfactory.additem (Runname)

Set runlist = Runfactory.newlist ("")
For each RN in Runlist
If Rn.name = Runname Then

Set stepfactory = rn. Stepfactory

Set TST = qttest.test
Set DESSTEPF = TST. Designstepfactory
Set dslist = Desstepf.newlist ("")
For each DS in Dslist
Set stp = Stepfactory.additem (Null)
Stp. Field ("St_step_name") =ds. Stepname
Stp. Field ("st_status") = "Passed"
Stp. Field ("st_description") = ds. Stepdescription
Stp. Post

Next

Rn. Status = "Passed"
Rn. Post
End If


Next
Next

Tdconnection.disconnectproject
Tdconnection.releaseconnection

Set tdconnection = Nothing
End Function

Code for QTP and ALM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.