Building a Test

SystemTest tests consist of elements, test vectors, and test variables. You can use each of these entities to create a variety of test scenarios ranging from a simple test that runs a series of elements once to a full parameter sweep that iterates over the values of test vectors that you define. Test vectors and test variables map data between SystemTest and the model or unit under test. You can optionally map test variables to results and perform analysis using the Test Results Viewer.

Test elements are discrete actions that run during test execution. You can use the test elements to integrate capabilities from other MathWorks products into SystemTest. SystemTest includes the following test elements:

  • MATLAB, which executes MATLAB code
  • Simulink, which connects the test to a Simulink model and uses test vectors to sweep across the model's inputs and parameters
  • Limit Check, which specifies pass/fail conditions
  • Vector Plot, which plots array or vector data as the test is executing
  • Scalar Plot, which plots scalar data for each iteration
  • IF, which controls the flow of a test based on a logical condition
  • Stop, which stops the test execution
  • Subsection, which helps manage complex test structures

Detailed information about additional test elements for SystemTest is available.

Test vectors specify the values that vary during each test iteration. SystemTest lets you use multiple test vectors whose values are arguments (for algorithms) or parameters and input signals (for models). You can define test vectors using any MATLAB expression or generate random values using probability distributions.

SystemTest includes normal (Gaussian) and uniform probability distribution functions.When used with Statistics Toolbox (available separately), SystemTest lets you also specify exponential, gamma, lognormal, Student's t , or Weibull probability distributions.

Test variables are used to store data for use by test elements during execution. You can initialize variables in the Pre Test or Main Test with any MATLAB expression.

Test Vector values generated using a probability distribution for Monte Carlo testing.
Test Vector values generated using a probability distribution for Monte Carlo testing.
Next: Executing Tests

Try SystemTest

Get trial software

Cómo acelerar aplicaciones en Simulink

View webinar