Book a Demo

Author Topic: Extracting tests attached to use cases  (Read 4399 times)

MaxRussell

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Extracting tests attached to use cases
« on: June 25, 2008, 10:45:30 pm »
I am currently working on a vba script for excel that will allow me to get all the tests for usecases under a selected package. However, I am finding that it is not returning the tests.

Where are tests 'stored' in relation to the ea.Element so that I can access them?

ta

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Extracting tests attached to use cases
« Reply #1 on: June 26, 2008, 03:05:03 am »
They are stored in the t_objecttests table.

Make sure your tests are really 'owned' by your use cases (or whatever). You won't get far if they are only associated via something like a Realize or Trace link.

There are also some other tables that might be involved: t_testclass, t_testplans, t_testtypes. The third is somewhat obvious, but how the first two fit into the picture is a bit obscure. [For example the TestClass field in t_objecttests seems to be incompatible with the t_testclass table.]

HTH, David
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Extracting tests attached to use cases
« Reply #2 on: June 26, 2008, 04:27:49 am »
David,

I think Max is trying to use the automation interface and not the database. Of course he can use the db from an AddIn, but that's only a solution for cases where nothing else helps. And, of course, the tests should be accessible by api without recourse to the database.

Max,

I'm not sure how you can retrieve the tests and, being not at the office now but at home I can't try it out, but the tests should be accessible by iterating through some collection like the use case element's parent package's connectors or the use case element's links or something.

Frank

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Extracting tests attached to use cases
« Reply #3 on: June 26, 2008, 08:38:41 am »
Element.Tests is a collection of EA.Test

MaxRussell

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Extracting tests attached to use cases
« Reply #4 on: June 26, 2008, 06:05:23 pm »
Thanks folks. Frank was correct. I was using the automation interface. We discovered here that Element contained tests which in turn as a collection contains items test, so ended up starting of the subroutine with:

Code: [Select]
For Each Element In thepackage.elements
      For Each Test In Element.Tests


One thing I would say that, although the stuff I needed was in the help, it did take a bit of searching to reach. However, the help couple with the VBA object browser works pretty well.
« Last Edit: June 26, 2008, 06:39:11 pm by MaxRussell »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Extracting tests attached to use cases
« Reply #5 on: June 26, 2008, 09:54:11 pm »
Quote
David,

I think Max is trying to use the automation interface and not the database. Of course he can use the db from an AddIn, but that's only a solution for cases where nothing else helps. And, of course, the tests should be accessible by api without recourse to the database.

Max,

I'm not sure how you can retrieve the tests and, being not at the office now but at home I can't try it out, but the tests should be accessible by iterating through some collection like the use case element's parent package's connectors or the use case element's links or something.

Frank
I agree Frank,

Actually, I checked the help first, to see if there was any mention of the three 'other' tables. There I did see the Tests collection - clearly documented where I would have expected it - as one of the properties of the Element class.

Since it seemed obvious to me - but that's likely the result of having read the API documentation more often than most; I am not suggesting this is easy for new users - I thought I'd cover the other possibility, using the database.

David
No, you can't have it!