To develop a device under test (DUT) plugin, extend (or inherit from) the DUT class, which itself extends the Resource class. The Open and Close methods MUST be implemented:
The DUT template generated by the Visual Studio class wizard includes minimal implementations of these calls.
Developers should add appropriate properties and methods to the plugin code to allow:
For examples of DUT plugin development, see:
TAP_PATH\Packages\SDK\Examples\PluginDevelopment\InstrumentsAndDutsDeveloping an instrument plugin is done by extending either the:
It is recommended to use ScpiInstrument over the Instrument class when possible.
Instrument plugins must implement the Open and Close methods:
Developers should add appropriate properties to the plugin code to allow:
Similar to DUTs, instruments must be preconfigured via the Bench menu choice, and tests will use the first instrument found that matches the type they need.
For instrument plugin development examples, see the files in:
TAP_PATH\Packages\SDK\Examples\PluginDevelopment\InstrumentsAndDutsOpenTAP provides a number of utilities for using SCPI instruments and SCPI in general. The ScpiInstrument base class:
Important methods and properties here include:
ScpiCommand, which sends a command.ScpiQuery, which sends the query and returns the results.VisaAddress, which specifies the Visa address of the instrument.ScpiQueryBlock<T>, which sends the block query, and parses the binary block as an array of type T. All numeric types except Decimal are supported.The SCPI attribute is used to identify a method or enumeration value that can be handled by the SCPI class.
For an example, see:
TAP_PATH\Packages\SDK\Examples\PluginDevelopment\TestSteps\Attributes\ScpiAttributeExample.csThe example below shows how the VisaAddress property for a SCPI instrument is automatically populated with values retrieved from VISA:

In some cases, VISA device discovery can cause issues.
This mostly occurs with VISA vendors who do not support it.
In that case, the behavior can be disabled by setting the
environment variable OPENTAP_NO_VISA_DISCOVERY to "true".
In rare cases, it may be necessary to resort to raw I/O reads and writes. This should generally be avoided because an incomplete read might interfere with the results of future queries. However, in situations such as streaming indeterminate-length data from the instrument, the use of raw I/O may become necessary.
A low-level API for this is available. The raw IO is located inside an explicit interface implementation, to access it do the following:
ScpiInstrument instrument = /* ... */;
IScpiIO io = ((IScpiInstrument) instrument).IO;
This provides access to raw reads and writes:
- Read, which reads data from the instrument into a user-provided byte buffer. The number of bytes read is placed in an out parameter.
- Write, which writes data from a user-provided byte buffer to the instrument.
OpenTAP comes with the ResourceOpen attribute that is used to control how and if referenced resources are opened. This attribute is attached to a resource property and it has three modes:
Open() and until after Close(). This is the default behavior.For an examples of Resource Management, see:
TAP_PATH\Packages\SDK\Examples\PluginDevelopment\TestSteps\Attributes\ResourceOpenAttributeExampleBoth examples have a base instrument that depends on a sub instrument , each having its own respective resource open attribute.
Upon running ResourceOpenBeforeAttributeExample test step in a test plan, the sub instrument will invoke its Open() method first, before the base instrument's Open() method. A delay is added to demonstrate the connection status of sub instrument connecting first.
When the test plan stops, the base instrument's Close() method will be invoked and disconnected. A delay is added to demonstrate that the sub instrument will invoke its Close() method after the base instrument has been disconnected.
Upon running ResourceOpenParallelAttributeExample test step in a test plan, the base instrument will open in parallel with the sub instrument. To demonstrate that the sub instrument is being invoked to open, a delay is added to delay the opening of the connection of the base instrument.
When the test plan stops, the sub instrument will disconnect and close its connection in parallel with the base instrument. Subsequently, a delay is added to demonstrate that the base instrument is being disconnected.
Resources with the resource ignore attribute are ignored by the test plan during execution. Hence, these resources will not invoke their Open() nor their Close() methods.
There is a setting that can affect the open and close sequence of resources. Under Engine settings, change resource strategy from Default Resource Manager to Short Lived Connections.
`09:14:45.593 TestPlan -----------------------------------------------------------------`
`09:14:45.594 TestPlan Starting TestPlan 'Untitled' on 10/13/2020 09:14:45, 1 of 1 TestSteps enabled.`
`09:14:45.606 TwoPortInst Opening TwoPortInstrument.`
`09:14:45.606 TwoPortInst Resource "TwoPortInst" opened. [65.4 us]`
`09:14:47.606 INST Opening Prior Instrument`
`09:14:47.606 INST PriorSubInstr connected: True`
`09:14:47.606 INST IgnoreSubInstr connected: False`
`09:14:47.606 INST Resource "INST" opened. [2.00 s]`
`09:14:47.606 TestPlan "Resource Open Before Example" started.`
`09:14:48.607 INST Closing Prior Instrument`
`09:14:50.607 INST PriorSubInstr connected: True`
`09:14:50.607 INST IgnoreSubInstr connected: False`
`09:14:50.607 INST Resource "INST" closed. [3.00 s]`
`09:14:50.607 TwoPortInst Closing TwoPortInstrument.`
`09:14:50.607 TwoPortInst Resource "TwoPortInst" closed. [50.1 us]`
`09:14:50.607 TestPlan "Resource Open Before Example" completed. [5.00 s]`
`09:14:50.613 Summary ----- Summary of test plan started 10/13/2020 09:14:45 -----`
`09:14:50.613 Summary Resource Open Before Example 5.00 s`
`09:14:50.613 Summary ------------------------------------------------------------`
`09:14:50.613 Summary -------- Test plan completed successfully in 5.01 s --------`
The above log demonstrates that Short Lived Connections always close before the test plan execution ends. However, using the Default Resource Manager, the resource connections will be closed only after the test plan execution has ended.
Using short lived connections result in more efficient resource management since connections are closed when no longer needed by the test plan.