Search code examples
countibm-doors

Requirement Coverage with DXL


i would like to find out the coverage of my requierements through inlinks from an other doors document. Here is the script:

Module m = current  
Object o = null

string NameLinkModule = "./xyz/abc"
Link InLink

int Req_Count = 0
int noInLinkCount = 0

for o in m do {
    
    if ((isMember(o."a","aaa")) && (isMember(o."b","bbb"))) {
        Req_Count++
        // Check for any inlinks at all
        bool no_inlink_flag = true
        for InLink in o <- NameLinkModule do {
            // If this executes, at least 1 inlink- flag and break
            no_inlink_flag = false
            break
        }
        // If no inlinks, increment and print object ID without inlink
        if ( no_inlink_flag ) {
            print o."ID"
            noInLinkCount++
        }
    }
}

print "Total Requirement Number = "
print Req_Count 
print "No In Link Count = "
print noInLinkCount
print "Coverage = "
int coverage = 100 * ((Req_Count - noInLinkCount) / Req_Count)
print coverage

Somehow the number of without any inlink objects is not correct, it is equal to the total number of requirements, which means no single objects has any inlink. But i have inlinks in current module. I checked the link module and there i have also links.

What am i doing false?

Thanks in advance!


Solution

  • In the GUI, when you click on an ingoing link, you see the text "not loaded", only when you open the module with the outgoing link, you see the information about the connected object.

    This concept translated to DXL is the difference between link references (LinkRef) and links (Link). In your case it is sufficient to count LinkRefs. Only if you need more information about the remote object, you first have to open the module with the outgoing link and then you will also have Links in addition to LinkRefs in your link-incoming module