LayoutTitle

Hoverable Dropdown

Open Test Architecture - Working with ALM


Introduction


OTA stands for Open Test Architecture. It is an Application Program Interface (API). It helps you to connect to ALM and fetches information as per your requirement.

The ALM or Quality Center (QC) Open Test Architecture API is a COM library that helps you to integrate any external applications with Quality Center. 

Before explaining the OTA architecture would like to take a tour of QC Modules. Below are the snapshots which makes you aware of how OTA coding would be written/seen.



Login Page

Login Architecture


ALM Modules


ALM Module Model


ALM Test Plan


Test Plan Architecture


ALM Test Lab


Test Lab Architecture


ALM Defect


Defect Architecture



Once you are familiar with screen flows and sections/tabs available on ALM screens then it will be very easy for you to understand the Architecture. OTA has clear notations and explains you what to pick one after the other based on the QC/ALM Hierarchies.


Few Examples:


'***************************************************************************
'Get the folders from the given folder (TEST PLAN)
'***************************************************************************

Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set sfolder = tdc.TreeManager.TreeRoot("Subject")
msgbox sfolder.Count

For i = 1 To sfolder.Count
   msgbox sfolder.Child(i).name
Next


'***************************************************************************
'Get the Scripts from the given path (TEST PLAN)
'***************************************************************************
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set sfolder = tdc.TreeManager.NodeByPath("Subject\FolderPath")
Set TFactory = sfolder.TestFactory

Set TestList = TFactory.NewList("")
msgbox TestList.Count
For Each TestSet In TestList
                                                                Print  TestSet.Name
Next

tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection
or
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set sfolder = tdc.TreeManager.NodeByPath("Subject\FolderPath")
Set TFactory = sfolder.TestFactory.NewList("")


For i =1 to TFactory.Count
   Print TFactory(i).Field("TS_NAME")
Next
'------------------------------------OR-----------------------------------------------

For Each TestCase In TFactory
                                                                print  TestCase.Field("TS_NAME")
Next

tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection


'***************************************************************************
'List down all the attachments from the folder
'***************************************************************************

Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set root = tdc.TreeManager.NodeByPath("Subject\FolderPath")
Set sfolder = root.FindChildNode("Data")
Set fact = sfolder.Attachments
Set alist = fact.NewList("")
'find the attachments
For Each att In alist
                                                Print att.Name
Next
tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection
------------------------------------OR-----------------------------------------------
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set attach = tdc.TreeManager.NodeByPath("Subject\FolderPath").FindChildNode("Data").Attachments.NewList("")
'find the attachments
For Each att In attach
                                                Print att.Name
Next

tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection


'***************************************************************************
'If Attachments Exist Delete form QC
'***************************************************************************
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "https://qcURL:8080/qcbin"
tdc.Login "userID", "PWD"
tdc.Connect "DOMAIN", "ProjectName"

Set root = tdc.TreeManager.NodeByPath("Subject\FolderPath")
Set sfolder = root.FindChildNode("Data")
Set fact = sfolder.Attachments
Set alist = fact.NewList("")

msgbox alist(1).Name
msgbox alist(1).ID
'find the attachments
I=1
For Each att In alist
                                msgbox alist(i).Name     ‘OR   msgbox att.Name
                                msgbox alist(i).ID      ‘OR    msgbox att.ID
                                                If Instr( att.Name, "ScriptName") Then
                                                                fact.removeItem(alist(i).ID)     ‘OR         fact.removeitem(att.ID)
                end If
i=i+1
Next

tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection


'***************************************************************************
'Retrieve test case from a folder in Test Plan
'***************************************************************************

Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"

Set Excel = CreateObject("Excel.Application")
Excel.WorkBooks.Add()   'Add a new workbook
' Get the first worksheet.
Set Sheet = Excel.ActiveSheet
QCConnection.ignorehtmlformat = True

Set QCTreeManager = QCConnection.TreeManager
'Specify the Folder path in TestPlan, All the scripts under that will be executed.

Set tsttr = QCTreeManager.NodeByPath("Subject\ARTS\Scripts\Manual")
Set tsetFact = tsttr.TestFactory
Set tsetList = tsetFact.NewList("")
'Retrieve the Individual Test Scripts from the Test Plan Folder
row=1
For Each tset in tsetList

                Set DesignStepFactory = tset.DesignStepFactory
                Set DesignStepList = DesignStepFactory.NewList("")
                Sheet.Cells(Row, 1).Value = tset.field("ts_subject") '.Path
                Sheet.Cells(Row, 2).Value = tset.Field("ts_name")
                Sheet.Cells(Row, 3).Value = tset.Field("ts_responsible")
                Sheet.Cells(Row, 4).Value =tset.Field("ts_status")          
                For Each DesignStep In DesignStepList 'save a specified set of fields.
                                Sheet.Cells(Row, 5).Value = DesignStep.Field("ds_step_name")
                                Sheet.Cells(Row, 7).Value = DesignStep.Field("ds_description")
                                Sheet.Cells(Row, 8).Value = DesignStep.Field("ds_expected")
                                Sheet.Cells(Row, 9).Value = DesignStep.Field("ds_user_01")
                                strOutput = Replace(strHTML, "", vbLf)
                                'remove the vbcrlf characters that show up in excel
                                strOutput = Replace(strOutput, vbCrLf, vbLf)

                                'msgbox ("step " & DesignStep.field("ds_step_name"))
                row=row+1
                Next
Next

Excel.ActiveWorkbook.SaveAs("D:\Documents and Settings\Administrator\Desktop\Testcases.xls")
Excel.Quit




'***************************************************************************
' To Pass a particular test
'***************************************************************************
fg_TestExecution "root\ARTS\Scripts","Automation","[1]Testcase_003","Passed","D:\Documents and Settings\Administrator\Desktop\Need registration.txt"
Function fg_TestExecution (testpath,testSetName,testCaseName,result,attachPath)
                Set QCConnection = CreateObject("TDApiOle80.TDConnection")
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"

                Set QCTreeManager = QCConnection.TestSetTreeManager
                Set  TestNode=QCTreeManager.NodebyPath(testPath)
                Set TestFact=TestNode.TestSetFactory
                Set TestSetlist= TestFact.Newlist("")
               
                For Each testSet in testSetlist
                                If  testSet.name = testSetName Then
                                                Set TestCaseFactory=testset.TSTestFactory
                                                Set TestCaseList=TestCaseFactory.newlist("")
               
                                                For Each TSTest in TestCaseList
                                                                If  TSTest.name= testCaseName Then
                                                                                Set TCRunFactory=TSTest.Runfactory
                                                                                Run_Name = "Auto_Run_" & Now()
                                                                                Set TCRun = TCRunFactory.AddItem(CStr(Run_Name))
                                                                                TCRun.CopyDesignSteps
                                                                                TCRun.Status = result
                                                                                TCRun.Post
                               
                                                                                Set TCRunStepFactory=TCRun.StepFactory
                                                                                Set TCRunStepList=TCRunStepFactory.newlist("")
                               
                                                                                For Each TCRunStep in TCRunStepList
                                                                                TCRunStep.Status=result
                                                                                                TCRunStep.post           
                                                                                Next
               
                                                                                Set AttachmentFactory = TCRun.attachments
                                                                                Set TCRunAttach = AttachmentFactory.AddItem(null)
                                                                                TCRunAttach.FileName = attachPath
                                                                                TCRunAttach.Type = 1
                                                                                TCRunAttach.Post
                               
                                                                End If
                                                Next
                                End If
                Next
End Function



'***************************************************************************
'        TO Change the Test Type Manual to QuickTest for particular script
'***************************************************************************
Set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://ALMPath/qcbin"
tdc.Login "UserName""Password"
tdc.Connect "Branch""ProjectName"

Set sfolder = tdc.TreeManager.NodeByPath("Subject\pathOfTheFolder\FileName")
Set TFactory = sfolder.TestFactory

Set TestList = TFactory.NewList("")
msgbox TestList.Count
For Each TestCase In TestList
                msgbox TestCase.Name
                msgbox TestCase.Field("TS_TYPE")
                if TestCase.Field("TS_TYPE") = "QUICKTEST_TEST" then
                    TestCase.Field("TS_TYPE") = "MANUAL"
                    TestCase.Post
                    TestCase.Refresh
                End if
                msgbox TestCase.Field("TS_TYPE")
Next

tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection


'***************************************************************************'        TO RETRIVE EFECTS
'***************************************************************************
Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"

Dim BugFactory, BugList
Set BugFactory = QCConnection.BugFactory
Set BugList = BugFactory.NewList("") ' Get a list of all the defects.

Dim Bug, Excel, Sheet, Row
Set Excel = CreateObject("Excel.Application")
Excel.WorkBooks.Add()   'Add a new workbook
Set Sheet = Excel.ActiveSheet
Row = 1
 ‘   Iterate through all the defects.
For Each Bug In BugList
'  Save a specified set of fields.
Sheet.Cells(Row, 1).Value = Bug.ID
Sheet.Cells(Row, 2).Value = Bug.Summary
Sheet.Cells(Row, 3).Value = Bug.DetectedBy
Sheet.Cells(Row, 4).Value = Bug.Priority
Sheet.Cells(Row, 5).Value = Bug.Status
Sheet.Cells(Row, 6).Value = Bug.AssignedTo
Row = Row + 1
 Excel.ActiveWorkbook.SaveAs("D:\FolderPath\Defect.xls")
Excel.Quit

'***************************************************************************
' Test performance Function (Get Total Pass and Failed Count)
'***************************************************************************
fg_RunCount "Root\ARTS\Scripts","D:\FolderPath\RunPerformance.xls"
Function fg_RunCount ( pathName, excelPathName)

                Set QCConnection = CreateObject("TDApiOle80.TDConnection")  'QC  Connection
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"
               
                Set Excel = CreateObject("Excel.Application")
                Excel.WorkBooks.Add()   'Add a new workbook
                Set Sheet = Excel.ActiveSheet
               
                Set QCTreeManager = QCConnection.TestSetTreeManager
                Set  TestNode=QCTreeManager.NodebyPath(pathName)
               
                Set TestSetFact=TestNode.TestSetFactory
                Set TestSetList= TestSetFact.Newlist("")
               
                Dim intRow, intRunCount, intRunPassed, intRunFailed
               
                intRow=2
               
                For Each TestSet in TestSetList                  
                                Set TestCaseFactory=testset.TSTestFactory
                                Set TestCaseList=TestCaseFactory.Newlist("")
               
                                For Each TSTest in TestCaseList
                                                Set TCRunFactory=TSTest.Runfactory
                                                Set TCRunList=TCRunFactory.newlist("")
                                               
                                                intRunCount = 0
                                                intRunPassed = 0
                                                intRunFailed = 0
               
                                                For Each TCRun in TCRunList
                                                                intRunCount= intRunCount+1
               
                                                                If TCRun.status = "Passed"  Then  'Counting the number of Runs
                                                                                intRunPassed = intRunPassed+1
                                                                ElseIf  TCRun.status= "Failed" Then
                                                                                intRunFailed =intRunFailed+1
                                                                End If
               
                                                Next
                                                               
                                                Sheet.Cells(intRow, 1).Value = pathName                            'placing in Excel sheet
                                                Sheet.Cells(intRow, 2).Value = TestSet.Name
                                                Sheet.Cells(intRow, 3).Value = TSTest.Name
                                                Sheet.Cells(intRow, 4).Value = intRunCount
                                                Sheet.Cells(intRow, 5).Value = intRunPassed
                                                Sheet.Cells(intRow, 6).Value = intRunFailed
               
                                                intRow=intRow+1
                                Next
                Next
               
                Excel.ActiveWorkbook.SaveAs(excelPathName)
                Excel.Quit

End Function

'***************************************************************************
'  Test Duration (Get average duration of a particular test case)
'***************************************************************************

 fg_TestDuration "Root\ARTS\Scripts","D:\FolderPath\TestDuration.xls"
Function fg_TestDuration(pathName, excelPathName)
                Set QCConnection = CreateObject("TDApiOle80.TDConnection")  'QC  Connection
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"
               
                Set Excel = CreateObject("Excel.Application")
                Excel.WorkBooks.Add()   'Add a new workbook
                Set Sheet = Excel.ActiveSheet
               
                Set QCTreeManager = QCConnection.TestSetTreeManager
                Set  TestNode=QCTreeManager.NodebyPath(pathName)
               
                Set TestSetFact=TestNode.TestSetFactory
                Set TestSetList= TestSetFact.Newlist("")
               
                Dim intRow, intRunCount, intRunDuration,intTotalDuration,intTestDuration
               
                intRow=2
               
                For Each TestSet in TestSetList                  

                                Set TestCaseFactory=testset.TSTestFactory
                                Set TestCaseList=TestCaseFactory.Newlist("")
               
                                For Each TSTest in TestCaseList
                                                intTotalDuration=0
                                                Set TCRunFactory=TSTest.Runfactory
                                                Set TCRunList=TCRunFactory.newlist("")
                                               
                                                For Each TCRun in TCRunList
                                                                intRunCount= intRunCount+1
                                                                intRunDuration=TCRun.field("RN_DURATION")
                                                                intTotalDuration=intTotalDuration+intRunDuration
                                Next

                                                intTestDuration=intTotalDuration/TCRunList.Count
                                                               
                                                Sheet.Cells(intRow, 1).Value = pathName            'placing in Excel sheet
                                                Sheet.Cells(intRow, 2).Value = TestSet.Name
                                                Sheet.Cells(intRow, 3).Value = TSTest.Name
                                                Sheet.Cells(intRow, 4).Value = intTestDuration
                                                intRow=intRow+1
                                               
                                Next
    Next
               
                Excel.ActiveWorkbook.SaveAs(excelPathName)
                Excel.Quit

End Function

'***************************************************************************
'    TestSet Performance(Get average Run of a particular Test set)
'***************************************************************************

fg_TestSetPerformance "Root\ARTS\Scripts","D:\FolderPath\TSPerformance.xls"
Function fg_TestSetPerformance(pathName, excelPathName)
                Set QCConnection = CreateObject("TDApiOle80.TDConnection")  'QC  Connection
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"
               
                Set Excel = CreateObject("Excel.Application")
                Excel.WorkBooks.Add()   'Add a new workbook
                Set Sheet = Excel.ActiveSheet
               
                Set QCTreeManager = QCConnection.TestSetTreeManager
                Set  TestNode=QCTreeManager.NodebyPath(pathName)
               
                Set TestSetFact=TestNode.TestSetFactory
                Set TestSetList= TestSetFact.Newlist("")
               
                Dim intRow, intRunCount, intTSRunCount, intTSRunAvg
               
                intRow=2
                intTSRunAvg=0
                               
                For Each TestSet in TestSetList                  

                                intTSRunCount=0

                                Set TestCaseFactory=testset.TSTestFactory
                                Set TestCaseList=TestCaseFactory.Newlist("")
               
                                For Each TSTest in TestCaseList
                                                Set TCRunFactory=TSTest.Runfactory
                                                Set TCRunList=TCRunFactory.newlist("")
                                               
                                                intRunCount = 0
               
                                                For Each TCRun in TCRunList
                                                                intRunCount= intRunCount+1
                                Next

                                                intTSRunCount= intTSRunCount+intRunCount
                                               
                                Next
                               
        intTSRunAvg=intTSRunCount/TestCaseList.Count

                                Sheet.Cells(intRow, 1).Value = pathName                           
                                Sheet.Cells(intRow, 2).Value = TestSet.Name
                                Sheet.Cells(intRow, 3).Value = intTSRunAvg
                                intRow=intRow+1
                Next
               
                Excel.ActiveWorkbook.SaveAs(excelPathName)
                Excel.Quit

End Function

'***************************************************************************

'Cycling scripts from Test Plan to TestLab after creating new Test Set '***************************************************************************

fg_MovingTests "Subject\Practice\Scripts", "Root\Practice\Scripts", "Manual_ARTS","MANUAL"
fg_MovingTests "Subject\Practice\Scripts", "Root\Practice\Scripts", "Automation_ARTS","QUICKTEST_TEST"
Function fg_MovingTests(testPlanPath,testLabPath,testSetName,testType)

                 Set QCConnection = CreateObject("TDApiOle80.TDConnection")
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"

                Set QCTreeManager=QCConnection.TreeManager
                Set TestNode=QCTreeManager.nodebypath(testPlanPath)
                Set TestFact = TestNode.TestFactory
                Set TestsList = TestFact.NewList("")
               
               
                Set QCTSTreeManager = QCConnection.TestSetTreeManager   
                Set  TreeNode=QCTSTreeManager.NodebyPath(testLabPath)
                Set TestSetFact=TreeNode.TestSetFactory
               
                Set NewTestSet=TestSetFact.AddItem(Null)' Creates new testset
                NewTestSet.name=testSetName
NewTestSet.field("CY_COMMENT") = TestSetComment
                NewTestSet.field("CY_USER_01") = TestSetDesigner
                NewTestSet.status="Open"
                NewTestSet.post
   
                Set TSTestFactory=NewTestSet.TSTestFactory
                For Each Tests in TestsList
                                If Tests.field("TS_TYPE")= testType Then
                                                TSTestFactory.Additem(tests)
                                End If
    Next

End Function

'***************************************************************************
'Importing Test Data File to the Master Script &
'Exporting Test Data File to the Master Script

'***************************************************************************

'Importing Test Data File to the Master Script
strCompletePath = ImportTestDataFile()
'Exporting Test Data File to the Master Script
ExportTestDataFile strCompletePath


Public Function ImportTestDataFile()

      Dim qtApp ' Declare the Application object variable
      Dim qtTestResources ' Declare a Resources object variable
      Dim QCConnection 'Declare a QC connection variable
                                               
      Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
      Set fso = CreateObject("Scripting.FileSystemObject") 'Create the File System Object
      'Set QCConnection = QCUtil.QCConnection ' Connect to the QualityCenter
                                               
      'If QCUtil.IsConnected then 'Check QC connection
      ' UserName = QCUtil.QCConnection.UserName 'Get the QC User Name
          'Else                      
         '  Reporter.ReportEvent 1, "Not connected", "Not connected to Quality Center"
           '       ExitTest()
                 '      End IF
                                               
                   ' Return the Resources object
                     Set qtTestResources = qtApp.Test.Settings.Resources
                                               
                    ' Get the External Data Table file name
                      If  instr(qtTestResources.DataTablePath, "\") Then
                           'if test resource is having Absolute Path
                             strFileName= Split(qtTestResources.DataTablePath,"\")
                              tmpFileName= Split(strFileName(Ubound(strFileName)),".")
                                                Else
                                                     'if test resource is having Relative Path
                                         strFileName = qtTestResources.DataTablePath
                                         tmpFileName = Split(strFileName,".")
                                                End If

                              'StrFName = tmpFileName(0)&"_"&UserName  
                               StrFName = tmpFileName(0)&"_"&Environment.Value("UserName")
                                strFolderPath = qtApp.Folders.Locate("..\Test Data\Data Files")
                               
                           ' Checking for the file
                         If fso.FileExists(strFolderPath&"\" & StrFName &".xls") Then
                          DataTable.Import strFolderPath&"\" & StrFName &".xls"
                                                Else
                   Reporter.ReportEvent micFail, "Check for the Test Data File", "Test Data File doesn't appear, please create"
                                  ExitTest()
                         End IF
                                               
                   Set qtApp = Nothing ' Release the Application object
                   Set qtTestResources = Nothing ' Release the Resources object
                   Set QCConnection = Nothing ' Release the Quality Center object
                   Set fso = Nothing ' Release the Fileobject
            strCompletePath = Array(strFolderPath,StrFName)
                ImportTestDataFile = strCompletePath    'strFolderPath&"\" & StrFName &".xls" 'Returning the test data file name
End Function

Public Function ExportTestDataFile(strCompletePath)
           datatable.SetCurrentRow(1)
            Datatable.Value("I_sBankID",1)="Raju"
           Datatable.Value("I_iLoc",1)="77777"

             datatable.SetCurrentRow(5)
             Datatable.Value("I_sBankID",1)="Ravi"
              Datatable.Value("I_iLoc",1)="88888"

            Set fso = CreateObject("Scripting.FileSystemObject") 'Create the File System Object                         
            ' Checking for the file
            If fso.FileExists(strCompletePath(0)&"\" & strCompletePath(1) &".xls") Then
                 fso.DeleteFile strCompletePath(0)&"\" & strCompletePath(1) &".xls"
                      DataTable.Export strCompletePath(0)&"\" & strCompletePath(1) &".xls"
                             Else
                        Reporter.ReportEvent micFail, "Check for the Test Data File", "Test Data File doesn't appear, please create"
                        ExitTest()
                  End IF
            Set fso = Nothing ' Release the Fileobject
                                                               
End Function

'***************************************************************************
'This function list out tests having defects and its Details
'***************************************************************************

Function fg_TestsWithBugs(pathName, excelPathName)
                Set QCConnection = CreateObject("TDApiOle80.TDConnection")
                QCConnection.InitConnectionEx "http://localhost:8082/qcbin"
                QCConnection.ConnectProjectEx "TESTING", "testing","qcsiteadmin", "qcsiteadmin"

                Set Excel = CreateObject("Excel.Application")
                Excel.WorkBooks.Add()
                Set Sheet = Excel.ActiveSheet

    Dim intRow
    intRow=2

                Set QCTreeManager = QCConnection.TestSetTreeManager
                Set  TestNode=QCTreeManager.NodebyPath(pathName)
               
                Set TestSetFact=TestNode.TestSetFactory
                Set TestSetList= TestSetFact.Newlist("")
               
                For Each TestSet in TestSetList                  

                                Set TestCaseFactory=TestSet.TSTestFactory
                                Set TestCaseList=TestCaseFactory.Newlist("")
               
                                For Each TSTest in TestCaseList
                                                Set TCRunFactory=TSTest.Runfactory
                                                Set TCRunList=TCRunFactory.newlist("")

                                                Set LinkFactTest=TSTest.BugLinkFactory
                                                Set TestBugList=LinkFactTest.Newlist("")

                                                If TestbugList.Count >=1 Then

                                                                Sheet.Cells(intRow, 1).Value = pathName
                                                                Sheet.Cells(intRow, 2).Value = TestSet.Name   
                                                                Sheet.Cells(intRow, 3).Value = TSTest.Name                     
                                                                For Each BugLink in TestBugList
                                                                                Set Bug=Buglink.TargetEntity
                                               
                                                                                Sheet.Cells(intRow, 4).Value = Bug.ID
                                                                                Sheet.Cells(intRow, 5).Value = Bug.Status
                                                                                Sheet.Cells(intRow, 6).Value = Bug.Summary
                                                                                intRow=intRow+1
                 Next

                                                End If
        Next
                Next

                Excel.ActiveWorkbook.SaveAs(excelPathName)
                Excel.Quit
End Function

‘=====================================
'To work on Test Lab use this code
‘=====================================

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
'qtApp.TDConnection.Connect "https://qcURL:8080/qcbin", "DOMAIN", "ProjectName", "userID", "PWD", False ' Connect to Quality Center


Set testSetFolderF = qcutil.QCConnection.TestSetTreeManager
Set tstSetFolder = testSetFolderF.NodeByPath("Root\FolderPath")

testSetName = "TestSetName"
testCaseName= Array("TestCase1","TestCase2","TestCase3")
For i=0 to ubound(testCaseName)
               Set testSetF = tstSetFolder.TestSetFactory
               Set testSet1 = testSetF.AddItem(Null)                                                               
                                                               
                Set testSetlist= testSetF.Newlist("")
                                                                               
                For Each testSet in testSetlist
                            If  testSet.name = testSetName Then
                                      Set TestCaseFactory=testset.TSTestFactory
                                     Set TestCaseList=TestCaseFactory.newlist("")
                                                                               
                                              For Each TSTest in TestCaseList
                                                    If  TSTest.name= testCaseName(i) Then
                                                                                                                                                Reporter.ReportEvent micPass, "Validate the script Status",TSTest.name&" Script Status is : "&TSTest.status
                                                Exit For                                                                                               
                                                         End If
                                                 Next
                                           End If
                                       Next
Next


‘=====================================





1 comment: