Write Unit Tests - MATLAB & Simulink (original) (raw)

Write tests using scripts, functions, or classes; apply fixtures; parameterize tests

Write tests using the MATLABĀ® unit testing framework to check that the outputs of MATLAB scripts, functions, or classes are as you expect. For example, you can test that actual output values match expected values, or you can test that outputs have the expected size and type.

The unit testing framework lets you write tests using scripts, functions, or classes:

For more information, see Ways to Write Unit Tests.

Functions

assert Throw error if condition false
functiontests Create array of tests from handles to local functions

Classes

Namespaces

Topics

Write Class-Based Tests

Write Parameterized Tests

Write Function-Based Tests

Write Script-Based Tests