We currently have Instrument Components that are inheriting from OpenTap.Resource.
With that in mind, we have a test step that has properties InstrumentComponent1 and InstrumentComponent2. However, the test plan xml will always initialize the Instrument settings values for InstrumentComponent1 and InstrumentComponent2 to the default instrument which is “Instrument1”.
Here is an example:
In this way, it will only open the DutSwitch1 during resource opening.
How can we change this behavior of setting the component value in test plan xml?
Is there a way to override the mentioned behaviour in the image below? To Allow the developers to configure the instrument even though they are of the same type?
@antonio.quizon if you don’t want a setting to be saved in the Test Plan XML you can use the [XmlIgnore] attribute.
I’m not sure what part of that second message you are looking to override, but you can do queries on the DUTs and Instruments Settings lists and select a specific one. This example shows both of those in use:
public IEnumerable<Dut> Duts
foreach (var someDut in DutSettings.Current)
var explicitDut = (Dut) someDut;
if (explicitDut != null) yield return explicitDut;
Hi @brennen_direnzo ,
Thanks for the response! Basically, I want to call an Open() connection to my DUTSwitch2 & DUTSwitch3 instead of DUTSwitch1. However, as seen in my first screenshot, when I add a test step to a test plan, the test step will take the first instrument found that matches the type they need (as seen in second screenshot).
Is it possible that when I add the test step (even without running the test plan), the DutSwitchComponentTwo and DutSwitchComponentThree test step properties have the values DUTSwitch2, and DUTSwitch3 instead of DUTSwitch1. These are all already defined in Instruments.xml bench settings file.
Are you generating this test plan?
Once you save the Test Plan those selections will remain.
But if you want to change the default, you can you a LINQ expression in your Test Step constructor to select a device of that type with the specified name.
Yes we are generating the test plan through Editor KS8400A. I see, so it is configurable through the constructor. Let me try these approaches Brennen, thanks alot!