Management of DUT Open

I have a DUT class that communicates with the device under test via. USB.
The DUT is powered by another Instrument so is initially un-powered.

So at test plan start, USB communication with the DUT is not available nor is detection of the DUT available.

When I start the test plan, the DUT resource Open() is called but the DUT is not yet available (it is powered down at this point).

I can think of a few ways to handle the DUT class Open() method so it is available before the DUT is actually powered, but I am wondering if I’m just approaching this the wrong way since it is probably a common use case.

Is there a defined way that the DUT resource Open() can be deferred until later in the test plan when it is powered on?

p.s. I have changed the TAP Engine setting ‘Resource Strategy’ to ‘Short Lived Connections’, and I think this kind of gets what I want with the DUT only being opened before use, but there are other instruments that I want open at the beginning of the test, so not sure I can use this.


Can the ResourceOpen attribute accomplish what you are looking for?

Example here on GitHub.

You could do it using the ResourceOpen attribute.

  1. Depend on the PSU
  2. In the Dut.Open, before anything else, turn on the power from the instrument.
  3. In the Dut.Close, turn off the power.

Alternatively, you could avoid doing all these things in the Open and create a test step for doing them instead. You could have a DelayOpen option in your DUT that skips everything in Open if set to true.

/// Inside the DUT:
[Display("Delay Open?")]
public bool DelayOpen{get;set;}
public override void Open(){
       if(DelayOpen) return;

/// Inside the test step:
public override Run(){

Thanks @Jim_B and @rolf_madsen ,

I looked at the resource ResourceOpen attribute.

On its own, it won’t accomplish what I need, but combining the [ResourceOpen(ResourceOpenBehavior.Ignore)] along with having the initial test step perform the open as described by Rolf is the best I can do.

This particular DUT has firmware stored in volatile memory and needs to be loaded at each power up over USB, so this step wold be a good point to perform the Open().

Thanks for the help,