0

I am writing VBA code using QC OTA to pull execution report needed to sent to client daily, is there any way to find number of test sets withing a folder so that I can run the loop to find total number of passed, failed scripts? now I am using manually entered value sTestSetCount

'Piece of the whole script
For sCount = 1 To sTestSetCount
    Set tsList = tsFolder.FindTestSets("P0049585")
    Dim oTestSet: Set oTestSet = tsList.NewList("").Item(sCount).TsTestFactory 'Item(1) Refers to the 1st test set in the path
    Dim testFilter1: Set testFilter1 = oTestSet.Filter

    'To Filter by Passed status
    testFilter1.Filter("TC_STATUS") = "Passed"
    vPass = vPass + oTestSet.NewList(testFilter1.Text).Count

    'To Filter by Failed Status
    testFilter1.Filter("TC_STATUS") = "Failed"
    vFail = vFail + oTestSet.NewList(testFilter1.Text).Count

    'To Filter by No Run status
    vNR = vNR + oTestSet.NewList("[Filter]{TableName:TESTCYCL,ColumnName:TC_STATUS,LogicalFilter:" & Chr(39) & "No" & Chr(32) & "Run" & Chr(39) & ",VisualFilter:" & Chr(39) & "No" & Chr(32) & "Run" & Chr(39) & ",NO_CASE:}").Count

    'To Filter by Not Completed status
    vNC = vNC + oTestSet.NewList("[Filter]{TableName:TESTCYCL,ColumnName:TC_STATUS,LogicalFilter:" & Chr(39) & "Not" & Chr(32) & "Completed" & Chr(39) & ",VisualFilter:" & Chr(39) & "Not" & Chr(32) & "Completed" & Chr(39) & ",NO_CASE:}").Count

    'To Filter by  N\A
    testFilter1.Filter("TC_STATUS") = "N/A"
    vNA = vNA + oTestSet.NewList(testFilter1.Text).Count

    'To Filter by Blocked
    testFilter1.Filter("TC_STATUS") = "Blocked"
    vBlocked = vBlocked + oTestSet.NewList(testFilter1.Text).Count

Next sCount
Worksheets("Status").Range("C10").Value = vPass + vFail + vNR + vNC + vNA + vBlocked
Worksheets("Status").Range("D10").Value = vPass
Worksheets("Status").Range("E10").Value = vFail
Worksheets("Status").Range("F10").Value = vNC
Worksheets("Status").Range("G10").Value = vBlocked
Worksheets("Status").Range("H10").Value = vNA
Worksheets("Status").Range("H11").Value = (vPass + vFail) / (vPass + vFail + vNR + vNC + vBlocked) * 100 & " %"
Application.StatusBar = "Execution Percentage = " & ((vPass + vFail) / (vPass + vFail + vNR + vNC + vBlocked) * 100) & "%"
Community
  • 1
  • 1

2 Answers2

0

Just get the TestSetFactory of the test lab folder and create a NewList without using a filter to get all test sets in that folder:

treeMgr = tdc.TestSetTreeManager
folder = treeMgr.NodeByPath("someTestLabPath")
testSetFact = folder.TestSetFactory
testSetList = testSetFact.NewList("")
sTestSetCount = testSetList.Count
Roland
  • 1,220
  • 1
  • 14
  • 29
0

This statement will help to take the count of the no run test case but if you apply more filter on "no run" test case.then try below code

testFilter1.Filter("TC_STATUS") = "'No Run'"

testFilter1.Filter("TS_STATUS") = "Complex"

this will help you to find the total no run test case and in no run how many test cases are in complex.

vNR = vNR + oTestSet.NewList("[Filter]{TableName:TESTCYCL,
ColumnName:TC_STATUS,LogicalFilter:" & Chr(39) & "No" & Chr(32) & "Run" & Chr(39) & 
",VisualFilter:" & Chr(39) & "No" & Chr(32) & "Run" & Chr(39) & 
",NO_CASE:}").Count
TylerH
  • 20,799
  • 66
  • 75
  • 101