NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a condition based on whether the following test is selected

Hi,

In addition to the 'Full Test' (Run UUTs), I would also like to allow for 'Partial Test' (Run Selected Steps Using Single Pass).

In order to run 'Partial Test' I must run some precondition steps.

I was thinking to write an 'Action type' step and in its precondition section to set:
a) run only in 'Partial Test' (I already have a flag for that)
b) run only if the next step (or any specific test for that matter..) is marked for testing.

My questions:
1) Is my approach appropriate or is there a better way to achieve the same goal?
2) How would you specify a condition of a specific test being marked for testing?

Thanks

Rafi
0 Kudos
Message 1 of 5
(3,398 Views)
Hello Rafi,

If your sequence file contains steps that you will always want to run before running your selected steps, it is best to place those steps inside the Setup step group. So when you run the selected steps, the steps in the Setup step group will always run. This way you do not need to use preconditions.

However, if you only want those steps to run when you select run selected steps and not when you run Test UUTs; you will have to use preconditions. I would still place those steps inside of the Setup step group. As a side note, there is a TestStand API method Execution.InInteractiveMode which will return a Boolean true if you choose to run selected steps.

In response to your second question, I would not think that you will need to mark a test using the above method since run selected steps will run all steps currently selected.

I hope that this information is helpful.

Regards,
Kevin L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,376 Views)
Hi Kevin and Thanks for your response,

Kevin, I think you missed my question.

The question was how to define a precondition based on selecting a specific test. (not if you used 'run selected steps'). The reasoning is that one test requires certain precondition steps, and another test will not. I only want to run the sequence if that specific test was selected.

Thanks Again

Rafi
0 Kudos
Message 3 of 5
(3,366 Views)
Hi Rafi,

Not sure if I have fully understood your question, but here goes....

The selected steps will be contained in an array of steps found in the property RunState.InitialSelection.SelectedSteps.

Therefore, you could match the steps names and set a boolean array to indicate which step was selected.
You can then use the state of each element of the boolean array as a precondition to perform different actions.


Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 5
(3,362 Views)
Thank you Ray,

That's exactly what I was looking for. Thank you!

Rafi
0 Kudos
Message 5 of 5
(3,355 Views)