NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access the Requirements property (& subproperties) of steps and sequences with the TestStand API

The concept of associating teststand objects to unit requirements for traceability purposes was added to TS 3.5, and I need to find out how to access the array of strings used to store unit requirements in step objects, sequence objects and sequencefile objects. The teststand help file points out that the requirements list of a sequencefile object is accessible using the PropertyObjectFile interface, and also points out that Requirements is a property of the sequence and step classes. Furthermore it implicitly states that the requirements property has a Links subproperty which is an array of strings, but that is pretty much the extent of the documentation on this new feature so far. There seems to be no expression function available to get to those requirements either.
 
I know that this feature was added to allow TestStand to interface with RG, and I am planning on using RG, but I would also like to do things with the requirements information within TestStand.
 
Anyone? 
0 Kudos
Message 1 of 11
(5,460 Views)
Hi,
 
Not sure if there is an API method to obtain the Requirements information.
 
But you could use the PropertyObject.GetValString with the Lookup String of "TS.SData.Requirements.Links[0]". (This is assuming you have obtained a reference to the Step and obtained a PropertyObject reference). Also you could obtain the size of the Links array and then obtain each string link.
 
If you have then you would have to use the full lookup string to the step, something like "RunState.Sequence.Main["<StepName>"].TS.SData.......".
 
Hope this helps
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 11
(5,462 Views)
Are you talking about the Requirements Gateway?  It is a separate product from NI that will do what you are looking for.  I haven't used it so I am not sure of the API chain to make it work.  Take a look and see if that is what you were thinking of.

Hope that this helps,
Bob Young

Sorry, I just re-read your original post and see that you are looking to also use the Requirements Gateway, so you obviously know about it.  I don't know what the API changes were that made it work so I am not going to be much help.

Sorry about posting before getting the correct information from the original.

Bob Young

Message Edited by Bob Y. on 08-24-2006 04:54 PM

0 Kudos
Message 3 of 11
(5,458 Views)

I tried your suggestion and it doesn't work. I attached the test sequence that I created for reference. Basically the first step has 2 requirements in the requirements list and the second step is a ActiveX adapter action step that attempts to retrieve the value of the 1st requirement of the previous step. I am using Runstate.PreviouStep to get to obtain a reference to the step, and the getvalstring method of the PropertyObject class to get to "TS.SData.Requirements.Links[0]". Here is the error message I get from the engine:

An error occurred calling 'GetValString' in 'PropertyObject' of 'NI TestStand API 3.5'
A subscript is not valid for objects that are not arrays. The subscript '[0]' could not be applied.
Error accessing item 'TS.SData.Requirements.Links[0]'.

By putting a breakpoint on step 2 and looking at the contents of RunState.Sequence.Main["Statement"].TS.SData.Requirements in the watch expression window I can see that Links is an empty string.

Any suggestions to get this to work?

0 Kudos
Message 4 of 11
(5,443 Views)

Hi,

You have the PreviousStep as the reference so you will need to obtain propertyobj ectreference by using the method Step.AsPropertyObject. This is going to give you grief as you are looking at the Previous Step and you will have to introduce another step in between your two steps.

Instead use RunState.PreviousStep.TS.Requirements as the reference. Now you can use PropertyObject.GetValString. You will also have to change the lookup string to just "Links[0]".

 

See attached JPG.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 5 of 11
(5,439 Views)

Got it. I attached the result of this post as an attachment. The attachment is a modified sequential model for TestStand 3.5 that will add the list of unit requirements for each step of each sequence (when the Links array is not empty) to the Step.Result container, and set the IncludeInReport flag to true. The modifications are in the  ProcessModelPostResultListEntry callback sequence of the sequentiqal model. By default this callback is disabled and can be enabled by turning on on-the-fly reporting, or manually. There is a knowledge base article on how to implement that manually: http://digital.ni.com/public.nsf/allkb/C65305FE996E28F98625704700006C6F.

Thanks for the help

 

0 Kudos
Message 6 of 11
(5,429 Views)
I would recommend against using the TS container in TestStand to access properties in general.  Rather than using this property, there is usually an API mtehod to obtain what you need.  In this case, you can use the method Step.Requirements to obtain a PropretyObject that is an array of strings.  The TS container is subject to change as new versions of TestStand release which can break your code.  However, the API will always be updated to properly access the neccesary properties.

Allen P.
NI
0 Kudos
Message 7 of 11
(5,414 Views)

Hi,

Allen is right you should also try to use any dedicated method, therefore in my example I have modified it to use the Step.Requirements.

Regards

Ray Farmer

Message Edited by Ray Farmer on 08-26-2006 09:43 AM

Regards
Ray Farmer
0 Kudos
Message 8 of 11
(5,411 Views)
In the first post of this thread you said that you are considering using Requirements Gateway in the future.  It seems you are trying to trace your requirements to your sequence accessing the requirement properties directly.  Have you taken a look at Requirements Gateway and its traceability features?  Is there anything it doesn't provide that you are having to implement yourself?
 
I have heard a few people in the community have questions about requirements traceability.  I think that sharing your application would be a great chance for you to hear suggestions from other TestStand users who are also working with requirements and may have approached the problem differently.
 
 
Thanks,
 
SantiagoD
0 Kudos
Message 9 of 11
(5,389 Views)
Here is the updated Sequential model sequence file. In this revision, I added a step at the top to to get a reference to the Step.Requirements property. I also modified the clone step to use the object reference Locals.ReqObj to create a local version of the Links subproperty of Step.Requirements. The rest of the sequence is the same.
 
To answer the question asked in the last post by SantiagoD, we are planning on using RG. We don't have RG in house yet, but we did participate in the beta program for RG so we are familiar with the features of the software. What I am trying to do here is add the requirements to the report for the reader's convenience. The traceability will be handled by RG.
0 Kudos
Message 10 of 11
(5,371 Views)