Author Topic: Getting Use Case Links to Requirements  (Read 6304 times)

cstokes

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Getting Use Case Links to Requirements
« on: January 09, 2004, 02:12:43 pm »
Hi,
   I am trying to create a tool in VB that lists all Use Cases and the requirements they satisfy. I am generating a file that lists USE CASE => REQUIREMENT. Any tips on how I can use the Automation Interface to acheive this.

Chris Stokes

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Getting Use Case Links to Requirements
« Reply #1 on: February 05, 2004, 01:49:19 pm »
A relationship matrix inside EA won't do? You can export to a csv-file from there too.
But I guess it is not exactly the kind of list you are looking for, or you might want to automate it further.

Mikkel

makarandd

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Getting Use Case Links to Requirements
« Reply #2 on: February 19, 2004, 02:19:33 am »
We need to use the realization relationship between the various requirements, usecases and the classes for getting the Links. Is there any way we can automate this ? Alternately, can we do some tagging instead of the drag,drop approach suggested in the help ?

barny451

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Getting Use Case Links to Requirements
« Reply #3 on: April 01, 2004, 12:06:36 am »
The downloadable VB example (which IMO may 'work' but is a can of worms to modify/extend) at least lets you learn how these things work.  Also, look at the code samples in the help.

Assuming p is already set as an ea.package object in your model, in VB the code is pleasingly simple;

dim p as ea.package
dim el as ea.element
dim c as ea.connector
for each el in p.elements
 if el.type = "UseCase" then
   for each c in el.connectors
     if c.type = "Realisation" then  'yes, that's realisation with an 's'
        ' get the element at the other end
        if c.clientid = el.elementid then
           otherel = getelementbyid(c.supplierid)
         else
           otherel = getelementbyid(c.clientid)
         endif
         if otherel.type = "Requirement" then
            '... do something
            print "Use Case " + el.name + " is realised by requirement " + otherel.name
         endif
      endif
   next c
 endif
next el

If you've used child diagrams/elements, you will need to add another loop 'for each subel in el.elements'

Above assumes you've got a recent EA which supports 'for each' iteration, see the automation help.

HTH
Ian