Hi ,
I am facing a issue with below OTA script . i want to filter the QC runs between two date range. QC has two user defined fields pass & fail count in the RUN table.
I want to filter the run table with the RN_EXECUTION_DATE field. after filtering , i need to display the test set folder & sum of Pass count and fail count .
OTA Code whch i am using
Public Function func_CreateExecutionReport()
Dim FC(50), PC(50) As Integer
Dim runF As RunFactory
Dim runList As TDAPIOLELib.List
Dim tmpY, r, TSet
Dim runFilter As TDFilter
Dim FieldName
Dim tmpStartDate, tmpEndDate As Date
Set TSetFact = tdc.TestSetFactory
Set TSSet = tdc.TSTestFactory
Set tsTreeMgr = tdc.TestSetTreeManager
Set tsFolder = tsTreeMgr.Root
Set tsFolderList = tsFolder.FindChildren("")
Set TSetFact = tdc.TestSetFactory
Set TSSet = tdc.TSTestFactory
Set tsTreeMgr = tdc.TestSetTreeManager
Set tsFolder = tsTreeMgr.Root
Set tsFolderList = tsFolder.FindChildren("")
rowCnt = rowCnt + tmpI
For tmpJ = 1 To tsFolderList.Count
PassCount = 0
FailCount = 0
StartDate = Home.DTPicker21.Value
EndDate = Home.DTPicker22.Value
tmpStartDate = Format(StartDate, "yyyy-mm-dd 00:00:00")
tmpEndDate = Format(EndDate, "yyyy-mm-dd 00:00:00")
Set FolderName = tsFolderList.Item(tmpJ).FindTestInstances("", False, "")
For tmpX = 1 To FolderName.Count
Set runF = FolderName.Item(tmpX).RunFactory
Set runFilter = runF.Filter
FieldName = "RN_EXECUTION_DATE"
runFilter(FieldName) = ">=" & "'" & tmpStartDate & "'"
runFilter(FieldName) = "<=" & "'" & tmpEndDate & "'"
Set runList = runF.NewList(runFilter.Text)
'Iterate through each test run for this test instance
For tmpY = 1 To runList.Count
PassCounter = runList.Item(tmpY).Field("RN_USER_02")
FailCounter = runList.Item(tmpY).Field("RN_USER_03")
If PassCounter <> "" Then
PassCount = PassCount + PassCounter
PC(tmpJ) = PassCount
Else
PC(tmpJ) = 0
End If
If FailCounter <> "" Then
FailCount = FailCount + FailCounter
FC(tmpJ) = FailCount
Else
FC(tmpJ) = 0
End If
Next tmpY
Next
ExecutionMetrics.Cells(1, 1).Value = "Test Case Execution Report"
ExecutionMetrics.Cells(2, 1).Value = "Project"
ExecutionMetrics.Cells(2, 2).Value = "Test Set Folder"
ExecutionMetrics.Cells(2, 3).Value = "PassCount"
ExecutionMetrics.Cells(2, 4).Value = "FailCount"
ExecutionMetrics.Range("A1", ExecutionMetrics.Cells(1, 4)).Merge
ExecutionMetrics.Cells(1, 1).Font.Bold = True
ExecutionMetrics.Cells(1, 1).Font.Size = 20
ExecutionMetrics.Cells(1, 1).Interior.Color = 5287936
ExecutionMetrics.Cells(1, 1).HorizontalAlignment = xlCenter
ExecutionMetrics.Range("A2", ExecutionMetrics.Cells(2, 4)).Font.Bold = True
ExecutionMetrics.Range("A2", ExecutionMetrics.Cells(2, 4)).Font.Size = 12
ExecutionMetrics.Range("A2", ExecutionMetrics.Cells(2, 4)).Interior.Color = 5287936
If (PC(tmpJ) = 0) And (FC(tmpJ) = 0) Then
' MsgBox "IN"
' MsgBox rowCnt & PC(tmpJ) & FC(tmpJ)
Else
rowCnt = ExecutionMetrics.UsedRange.Rows.Count + 1
ExecutionMetrics.Cells(rowCnt, 1).Value = strProject
ExecutionMetrics.Cells(rowCnt, 2).Value = tsFolderList.Item(tmpJ).Name
ExecutionMetrics.Cells(rowCnt, 3).Value = PC(tmpJ)
ExecutionMetrics.Cells(rowCnt, 4).Value = FC(tmpJ)
ExecutionMetrics.Range("A1", ExecutionMetrics.Cells(rowCnt, 4)).Borders.LineStyle = xlContinuous
End If
Next
End Function