Okay I've now tried to do somelike this, but somehow I can't get the variable from one code module to the other.
I have one solution handling all my instrument functions, which I've compiled to a .dll (Instruments.dll), which I've then included/added referrenced to in another solution.
Using the functions from Instruments.dll in the current solution, is working fine, when using the modules directly in the test suite, building test cases (drag-n-drop functions from Module browser to test cases). In which case I can assign values through data binding, and validate results this way.
But these test cases are somewhat confusing to look at, since the Instrument.dll is made with namings that referrence to a specific instruments, e.g RelayBoardRelay1On, DaqValidateAiCh101 and so on, so they can be used in any applications.
What I then do (or want to do) is wrap these modules in in a user code module containing e.g.:
Code: Select all
[TestModule("20ECC8A8-36BB-4FBD-9743-2B7467489A1A", ModuleType.UserCode, 1)]
public class DutExternalPowerOff : ITestModule
{
/// <summary>
/// Constructs a new instance.
/// </summary>
public DutExternalPowerOff()
{
// Do not delete - a parameterless constructor is required!
}
/// <summary>
/// Performs the playback of actions in this module.
/// </summary>
/// <remarks>You should not call this method directly, instead pass the module
/// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
/// that will in turn invoke this method.</remarks>
void ITestModule.Run()
{
ITestModule ExtPow = new Instruments.DaqU2351a.Ch501Bit3OffA();
ExtPow.Run();
// Alternate way is:
// TestModuleRunner.Run(ExtPow);
}
To make the test cases easier to read (in the rxtst file), as I now have a step in my test case called "DutExternalPowerOff" instead of "Ch501Bit3OffA (Instuments)".
My problem is now when I have an instrument function that takes variables as input for e.g. validating voltages. I have no problems if I just accept the "DaqValidateAiCh101 (Instruments)" step in my test case, because it will then say I have 2 unbound variables (upper and lower limit), which I can then just bind to values as appropiate. But when I wrap up this "DaqValidateAiCh101" in user code so I can get a "ValidateOutput1On" step, I can't seem to forward the desired limits to my public variables (upper and lower limit) in DaqValidateAiCh101 (which are created by "Insert Module Variable" function) and in the code module for the function in Instruments looks like:
Code: Select all
string _lowerLimit = "-10";
[TestVariable("483A5439-629F-4E1B-BE38-E4605ABD1B67")]
public string lowerLimit
{
get { return _lowerLimit; }
set { _lowerLimit = value; }
}
Trying to doing as described, I would think that I in my current solution I would have to do something like:
Code: Select all
string _outOnLow = "";
[TestVariable("773A5039-629F-4E1B-BE38-E4605ABD1B67")]
public string outOnLow
{
get { return Instruments.DaqValidateAiCh101.lowerLimit; }
set { Instruments.DaqValidateAiCh101.lowerLimit = value; }
}
But this isn't working, so I'm clearly missing something. I've also tried:
Code: Select all
ITestModule OutputOn = new Instruments.DaqValidateAiCh101();
[TestVariable("773A5039-629F-4E1B-BE38-E4605ABD1B67")]
public string outOnLow
{
get { return OutputOn.Instance.lowerLimit; }
set { OutputOn.Instance.lowerLimit = value; }
}
and some variations in between.
I don't need to get values back from the DaqValidateAiCh101 function, as that will pass/fail the measurement, and also write in the report, but I do need to get the correct limits into the DaqValidateAiCh101, as I currently gets a PASS verdict everytime, as the default values are the entire range of possible measurements.
Dang that was a long text/description, but hope it makes some sense, so someone can help me to understand what I'm missing.
Best regards
/KAB