Using OpenTAP API in custom applications

Starting a thread on implementing the API in custom applications since
there is not so much documentation or examples in this area.

First question:
How to handle configuration problems (missing plug-in(s), DUTs, Instruments…) when loading a testplan? There is an OpenTap.TestPlan.PlanLoadException class. Is this supposed to be raised if the Testplan.Load() detects any problems (like missing plug-ins)? Or how to detect problems during/after testplan load?

@GoranJohnsson yes, in general that is the exception that would be thrown. You can take a look at how this is integrated into the CLI as that is the most basic application example:

There is also the TUI that serves as a more complete example of a custom application:

Hmm… If I use Testplan.Load(file) I get no exception if some DUT and/or Instruments are missing in the current configuration. Instead I have to use TapSerializer and some Deserialize method. Its Errors property returns expected/correct errors.
Testplan.Load() seems to do some more things (have not investigated). Possibly caused by/due to .NET5 that my project is using?

1 Like

@GoranJohnsson after a TestPlan.Load, technically, you can still update your Settings, so if the plugin exists, but the Bench Profile is not configured, it can still be updated at this point. So that is why you don’t see an error. Using TestPlan.Open or TestPlan.Execute you would see one for this case of missing instrument configurations.

OpenTAP has not yet been migrated to .NET5, so it is possible there are some incompatibility issues there.

1 Like