Contenuto principale

Create MATLAB Tests

R2026b
Create tests for MATLAB® source code
Since R2023a

Use MATLAB Test™ to generate unit tests for source code from:

  • MATLAB scripts, functions, and classes

  • Statements in the Command History panel

  • Parts of the source code that were missed by existing tests

  • Requirements that implement MATLAB source code

You can also generate equivalence tests for MATLAB source code.

Additionally, you can create baseline tests to validate your MATLAB code against previously inspected data.

MATLAB Test extends the test authoring capabilities of the MATLAB unit testing framework. For more information, see Extend MATLAB Unit Testing Framework with MATLAB Test.

Classes

matlabtest.parameters.BaselineParameterBaseline parameter (Since R2024b)
matlabtest.baselines.MATFileBaselineRepresentation of baseline data stored in MAT file (Since R2024b)
matlabtest.constraints.EqualsBaselineTest if value is equal to baseline data (Since R2024b)

Functions

matlabtest.parameters.matfileBaselineDefine data in MAT file as baseline data (Since R2024b)
verifyEqualsBaselineVerify value is equal to baseline data (Since R2024b)

Topics