Validate all instruments in a session

Hi,

I’m developing a test system which communicates with OpenTAP remotely using Runner. In order to avoid started test runs to fail due to instrument issues, I would like to find a way to validate that all instruments in the session are up-and-running properly. The function/method should identify any instruments e.g. not responding. This information will then be fed back to the user so that he/she can check connections etc (this communication is done using the system backend/frontend). By instrument I mean a custom-made instrument plugin.

Some of the options I have considered are:

  • Create a test step which attempts to open all of the instruments. If any instrument fails to open, the test step triggers an error verdict. I’m not sure though how it can be conveyed exactly which instrument that failed. I guess one option would be to create one such test step for each instrument, but that approach seems a bit cumbersome to me.
  • Place the Open() method of the instrument inside a try block and catch any exception thrown when attempting to open the instrument. The full type name of the instrument can then be added to the exception, possibly using a custom-made exception which takes the full name as an argument. Though, I don’t know where to catch this exception in a test step or similar, as instruments are opened prior to executing any test step code.

Any ideas on how to accomplish this kind of validation?

Thanks in advance!
Tomas

Hey Gortom,

At our place we handle this validation in the Open() of the instruments themselfs. Only instruments that are used by the testplan will be opened, thus ts not required to add aditional teststeps for this purpose.

I believe a flag is set when a instrument opens succesfully. Hope this is helpfull.

Kind regards, Marc

Thanks for the reply, marc_vd_klooster!

I found another way which suits my system better, since I need to validate all instruments before attempting to execute the test plan that includes the actual test cases.

This is how I did it, in case someone wants to do something similar:

I created a validation test step which loops over the instruments in InstrumentSettings.Current and calls a Validate function on each instrument. The instrument plugins implement an interface which has the Validate function that does the validation and returns a result. This way, each instrument plugin can implement the Validate function that suits best for that particular instrument. The validation test step is then executed in a dedicated validation test plan and the verdict is set based on the validation result.