Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Counting testcase linked to requirement and ECU

$
0
0

Hello QC-lite,

I'm trying to get out from QC all testcase linked to a requirement and to the to ECU. I have two categories of requirement: Customer Function (CF) and No Customer Function (NCF). I have solve the problem in the NCF-case (ie getting and counting the tests in that case).

I have partly solve the problem also in the CF-case (only count testcase linked to the requirement). My problem hier ist to count Testcase linked to the ECU.

For example, I have 13 MIL-test linked to the requirement Lane Departure (ID: 500467656). In this 13 MIL-tests, we have 2 for SA-ECU, 4 for the AD-ECU and 7 for the CM-ECU.  And hier is my biggest problem. How can I get and count these ECU-tests out ehith the makro.

 

Hier is a piece of makro and you wil see what I'am trying to say.

'#######################################################################
' Macros reading qc-data

'#######################################################################
Option Explicit


Global tdc As TDConnection


Public Const ColFunc = 2 'Column NCF or CF
Public Const ColRedIDTP = 3  ' Column with QC Requirement-ID

Public Const Col_MIL = 6   'the number of Tests is written hier
Public Const Col_SIL = 7
Public Const Col_HIL = 8



'******************************************************************************************************
' Function:      countQCTests
' Get out and count tests from QC
'******************************************************************************************************
Sub countQCTests()
    Dim mS As Worksheet
    Set mS = ActiveWorkbook.Sheets(M_SheetName)
    Dim actLine, ReqID, countToDoLine, countExLine As Long
    Dim tfList, tfList2, ListAll, reqList As List
    Dim reqFact As ReqFactory
    Dim testFact As TestFactory
    Dim tpReq As Req
    Dim reqFilter, reqFilter2, reqFilter3 As TDFilter
    Dim testFilter As TDFilter
    Dim req2
    
    Set reqFact = tdc.ReqFactory
    Set reqFilter = reqFact.Filter
    Set reqFilter2 = reqFact.Filter
    Set reqFilter3 = reqFact.Filter
    'Set reqFilter4 = reqFact.Filter
    
    Set testFact = tdc.TestFactory
    Set testFilter = testFact.Filter
    'Delete data
    actLine = M_FirstDataline
    countToDoLine = 0
    Application.StatusBar = "Delete data..."
    'Is there an ReqID ? ?
        If ReqID <> "" Then
            mS.Cells(actLine, Col_MIL) = "?"
            mS.Cells(actLine, Col_SIL) = "?"
            mS.Cells(actLine, Col_HIL) = "?"
            countToDoLine = countToDoLine + 1
        End If
        actLine = actLine + 1
    Loop

    actLine = M_FirstDataline
    countExLine = 0
    Application.StatusBar = CStr(countExLine) & " von " & CStr(countToDoLine) & " gelesen"
    Do While mS.Cells(actLine, M_ColEmptyDataEnd1) <> "" Or mS.Cells(actLine, M_ColEmptyDataEnd2) <> ""
        'Is there an ReqID ? ?
        ReqID = mS.Cells(actLine, M_ColRedIDTP)
        If ReqID <> "" Then
            Set tpReq = reqFact(ReqID)
            Select Case mS.Cells(actLine, M_ColStgOrFunc).Text
                Case NCF
                    'Set the ReqFilter
                    reqFilter.Filter("RQ_FATHER_NAME") = "^" & tpReq.Path & "^"
                    reqFilter2.Filter("RQ_FATHER_NAME") = "^Requirements\list^ Or ^Requirements\Development^"
                    'Debug reqFilter2.Filter("RQ_REQ_NAME") = "*"
                    reqFilter.SetXFilter "REQ-TO-FROM-REQ", False, reqFilter2.Text
                    testFilter.SetXFilter "TEST-REQ", True, reqFilter.Text
                    Set tfList = testFact.NewList(testFilter.Text)
                    groupAndWriteTfcounts mS, actLine, tfList
                    countExLine = countExLine + 1
                Case CF
                    reqFilter.Filter("RQ_REQ_ID") = ReqID
                    reqFilter2.Filter("RQ_FATHER_NAME") = "^Requirements^"
                    reqFilter2.SetXFilter "REQ-TO-FROM-REQ", True, reqFilter.Text

                    testFilter.SetXFilter "TEST-REQ", True, reqFilter2.Text
                    Set tfList = testFact.NewList(testFilter.Text)
                    reqFilter3.Filter("RQ_FATHER_NAME") = "^Requirements^"
                    reqFilter3.SetXFilter "REQ-TO-FROM-REQ", True, reqFilter2.Text
                    testFilter.Clear
                    testFilter.SetXFilter "TEST-REQ", True, reqFilter3.Text
                    Set tfList2 = testFact.NewList(testFilter.Text)
                    Set ListAll = ListConc(tfList, tfList2)
                    reqFilter2.Filter("RQ_TYPE_ID") = "Not Undefined"
                    Set reqList = reqFilter2.NewList
                    For Each req2 In reqList
                        testFilter.Clear
                        reqFilter.Clear
                        reqFilter.Filter("RQ_FATHER_NAME") = "^" & req2.Path & "^"
                        testFilter.SetXFilter "TEST-REQ", True, reqFilter.Text
                        Set ListAll = ListConc(ListAll, testFilter.NewList)
                        reqFilter3.Clear
                        testFilter.Clear
                        reqFilter3.Filter("RQ_FATHER_NAME") = "^Requirements^"
                        reqFilter3.SetXFilter "REQ-TO-FROM-REQ", True, reqFilter.Text
                        testFilter.SetXFilter "TEST-REQ", True, reqFilter3.Text
                        Set ListAll = ListConc(ListAll, testFilter.NewList)
                    Next
                    groupAndWriteTfcounts mS, actLine, ListAll
                    countExLine = countExLine + 1
            End Select
            reqFilter.Clear
            reqFilter2.Clear
            reqFilter3.Clear
            testFilter.Clear
        End If

        actLine = actLine + 1
        
    Loop

End Sub
'******************************************************************************************************
' Function:      groupAndWriteTfcounts
'******************************************************************************************************
Function groupAndWriteTfcounts(mS As Worksheet, ByVal actLine As Long, ByVal tfList As List)
    Dim tf As Test
    Dim MIL, SIL, HIL As Integer
    MIL = 0
    SIL = 0
    HIL = 0

    For Each tf In tfList
        Select Case True

            Case tf.Field("TS_USER_5") Like "*MIL*"
                MIL = MIL + 1
            Case tf.Field("TS_USER_5") Like "*HIL*"
                KHIL = KHIL + 1
            Case tf.Field("TS_USER_5") Like SIL
                SIL = SIL + 1
        End Select
    Next
    'write value
    mS.Cells(actLine, Col_MIL) = MIL
    mS.Cells(actLine, Col_SIL) = SIL
    mS.Cells(actLine, Col_HIL) = HIL
End Function
'******************************************************************************************************
' Function:      ListConc
'******************************************************************************************************
Function ListConc(ByVal ListA As List, ByVal ListB As List) As List
    Dim el
    Set ListConc = ListA
    For Each el In ListB
        ListConc.Add (el)
    Next
End Function

 Please see in attachement an excel-sheet for explanation.

 

Thanks

 

Fifi

 

 


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>