Create Signal Builder Block Test Vectors

If you have created a Simulink® model test harness using a Signal Builder block, you can automate the running of all your test cases by integrating them into a SystemTest™ test. This also offers the ability to collect cumulative model coverage metrics for all your Signal Builder test cases.

The most common workflow for this feature is to create a Simulink element and then create the test vector from within the element, as follows:

  1. In the SystemTest desktop, create a Simulink element by clicking the Main Test node in the Test Browser, and clicking the New button. Select Test Element > Simulink.

  2. Type the name of the model, or use the Browse button to locate it. This should be the model that includes the Signal Builder block whose test cases you are interested in.

    When you click OK, the model opens.

    This example uses the model systemtestsfcar.

  3. In the Simulink element, click the up arrows in the banner of the Override Inport Block Signals with SystemTest Data section to close it.

  4. Click the down arrows in the banner of the Run Signal Builder test cases from SystemTest section to expand it.

  5. Enable the Signal Builder test cases by selecting the Use test vector check box.

  6. Click the down arrow and select <New Signal Builder Block test vector...>.

  7. The Insert Test Vector dialog box opens and Signal Builder Block is the selected test vector type.

    Keep the default test vector name or type a new one.

  8. On the General tab, type the name of the model you used in the Simulink element, or click the Browse button to locate it.

      Note:   You cannot use a Signal Builder Block test vector with a Simulink element that uses a different model. You must refer to the same model in both the test vector and the Simulink element.

  9. When the model is found, the Signal Builder test cases appear in the Test Cases section.

    If there are any test cases you do not want to test, you can disable them using the check boxes. Test cases that are checked will be tested.

  10. You can click the Test Signals tab to view the test signals associated with your Signal Builder block.

  11. Click OK to finish creating the test vector.

  12. To view or edit the test vector after it is created, click the Test Vectors tab in the SystemTest desktop.

  13. Optionally create other elements, test vectors, variables, or saved results, and run your test.

    Note:   If you make changes in the underlying Signal Builder block in your model, you can click the Evaluate button in the Test Vectors pane any time to see the changes reflected in the user interface. However this is not necessary to pick up the changes for running the test. When you run a test containing a Signal Builder Block test vector, the SystemTest software automatically queries the model for the latest information in the Signal Builder block.

    Note:   When you run the test, the Signal Builder test cases are run in the order in which they appear in the Signal Builder block in your model. This same order is reflected in the Test Vectors pane in the SystemTest software, unless you change the order in the table by sorting the columns.

    Note:   You may have tested a Signal Builder block in previous SystemTest versions by using the Override Block Parameters with SystemTest Data section of a Simulink element. In that scenario you would create a new mapping to the Signal Builder block.

    However, using the Run Signal Builder test cases from SystemTest section in the Simulink element and creating the Signal Builder Block test vector is a better and easier solution. Because the Signal Builder test cases are in a test vector, you can do more with them, such as plotting. Also, the signals are stored in the SystemTest results set, rather than the index of the test case.

    Note that if you have a Simulink element that contains the mappings from the former way of including a Signal Builder block, and then you use the new Signal Builder Block test vector and use the new section in the same Simulink element, the test will use the new information in the Run Signal Builder test cases from SystemTest section in the Simulink element.

Was this topic helpful?