You use a set property test step to verify a driver's set code or set command for a property. You provide a name for the step, select the driver property to test and the values to test it with, and define the conditions for the step's passing.
Settings | Dscription |
---|---|
Name | You provide a name for each test step. The name appears in the Test Explorer tree as well as in the results output. |
Property to Test | A set property step can test only one property. You choose the property from the Property to Test list. Additional properties can be tested with additional steps, or with a sweep step. |
Object(s) to Test | A property may be defined for the instrument or for a group object. If you are testing a group object property, you select which object you want tested in the Object(s) to Test list. |
Define the Values to Test | If the property is has enumerated values, you can select one of the defined values, all of the supported values, or some other value. If the property's value is a double-precision number, you can select a value within its defined range, all supported values, or some other value. For a double, you set the number of values tested for all supported values in the Preferences dialog box (see Number of Values to Test). |
Select When this Step Passes | The step passes when one or both of two conditions are met:
If you select more than one of these conditions, then both conditions must be met for the step to pass. If no boxes are selected, the test will pass. |
Click the Set Property
option
in the Test Steps list box.
Click the Add button.
In the Name field,
enter Set Display Contrast
.
In the Property
to test list, select DisplayContrast
.
For Define the value(s)
to test, select All supported values
.
For Select when this step passes,
Select If no MATLAB software or instrument error occurs.
Select If current value matches configured value.
Click File and select Save.
You can run an individual test step to verify its behavior:
Select Set Display Contrast
in
the Test Explorer tree.
With the cursor on the selected name, right-click to bring up the context menu.
In the context menu, select Run this step only.
You may want to repeat this step as you observe the oscilloscope display. The test sets the display contrast to five different values: lowest acceptable value (1%), highest acceptable value (100%), and three approximately equally spaced integer values between these limits.
The tool automatically displays the Output Window with the test results.
This test step passed because, for each of the five display contrast settings, the tool read back a value that was equal to the configured value.
You use a get property test step to verify a driver's ability to read a property. You provide a name for the step, select the driver property to test, and define the conditions for the step's passing.
The settings for the get property step are the same as for a Test Step: Set Property, except that instead of providing a value to write, you can provide an output argument variable.
Output Argument. The test step assigns the optional output argument variable the value that results from reading the property. The variable is available for Exporting Results, after the test step has executed.
Click the Get Property
option
in the Test Step field.
Click the Add button.
In the Name field,
enter Getting Display Contrast
.
In the Property
to test list, select DisplayContrast
.
In the Output argument field,
enter DispContr
.
For Select when this step passes,
Unselect the box for If no MATLAB software or instrument error occurs.
Select If property value is,
and enter a value of 80
.
This value is chosen to generate a failure. If this step follows
the previous step in the example, the display contrast is still set
at 100
. If this step is run by itself, the display
contrast is set to 50
by the *RST
command
that is executed as part of your connect code for the driver.
Click File and select Save.
You run the individual test step to verify its behavior.
Select Get Display Contrast
in
the Test Explorer tree.
With the cursor on the selected name, click the right mouse button to bring up the context menu.
In the context menu, select Run this step only.
Note that the test fails, reading a value of 50
while
expecting a value of 80
.
A properties sweep step allows you to test several properties in a single step. All selected properties are tested for all supported values. (In the case of properties with double-precision values, you determine the Number of Values to Test, in the Test Preferences dialog box.)
The fields for name and passing conditions are the same as other types of test steps. The sweep step also requires that you select which properties and groups to test.
Select the Properties to Test. You may select any or all of the properties for testing in a sweep step. You may find it convenient to create several sweep steps for testing related groups properties together.
Select the Group Object to Use on Sweep. For those properties defined for group objects, you can select a particular group object to test, or all the group objects. You can also define different sweep steps for different group objects.
Click the Properties Sweep
option
in the Test Step field.
Click the Add button.
In the Name field,
enter All Properties Sweep
.
For Select the properties to test, click Select All.
In the Select the group object(s) field,
For the Measurement group,
select All Measurement group objects
.
For the Trigger group,
select All Trigger group objects
.
For Select when this step passes,
Select If no MATLAB software or instrument error occurs, and
Select If current value matches configured value
Click File and select Save.
You run the sweep test step to verify its behavior.
Select All Properties Sweep
in
the Test Explorer tree.
With the cursor on the selected name, click the right mouse button to bring up the context menu.
In the context menu, select Run this step only.
The Output Window is updated as each property in the sweep is tested. Note that the entire sweep is only one step in the overall test.
A function test step sends a function call to the instrument. You select the function called, the input data and output arguments (if required), and the conditions for passing.
Name. You provide a name for each test step. The name appears in the Test Explorer tree as well as in the results output.
Function to test. A function step can test only one function. You choose the function from the Function to test list. Additional functions can be tested with additional steps.
Function definition. The tool displays below the selected function what the call command for the function looks like. This helps you when deciding what input and output arguments to supply.
Input argument(s) and Output argument(s). You provide input arguments as a comma-separated list of data, strings, character vectors, or whatever the function is expecting.
You provide output argument variable for any data returned from the function. The output arguments can be used to determine if the test step passes, or for Exporting Results after the test step has executed.
Select when this step passes. The step passes when any of three conditions is met:
If no instrument or MATLAB software error occurs as a result of attempting to execute the function
If the returned output arguments match expected values
If the output of a specified function is true
If you select more than one of these conditions, then all selected conditions must be met for the step to pass. If no boxes are selected, the test will pass.
Click the Function
option
in the Test Step field.
Click the Add button.
In the Name field,
enter Config Waveform
.
In the Function
to test list, select configureWaveform
.
In the Input argument(s) field,
type 'CH1', 1, 3000
.
In the Output argument(s) field,
type Channel, StartAdr, StopAdr
.
For Select when this step passes,
Select If no MATLAB software or instrument error occurs.
Select If output arguments are,
and enter in its field 'CH1', 1, 2500
.
Unselect If output of function ... is true.
Click File and select Save.
Note that you set the input argument for the stop address to 3000
,
but you set the expected value for its output argument, StopAdr
,
to 2500
. This is because the maximum address of
the oscilloscope is 2500
. If you attempt to exceed
that value, the oscilloscope address is set to the maximum.
You can run an individual test step to verify its behavior
Select Config Waveform
in
the Test Explorer tree.
With the cursor on the selected name, click the right mouse button to bring up the context menu.
In the context menu, select Run this step only.