Main Content

Script-Based Unit Tests

Write and run test scripts

Write script-based tests to check that the outputs of MATLAB® scripts, functions, or classes are as you expect. For example, you can use the assert function to test for actual output values that match expected values. Or you can test that the output variables have the correct size and type. To run your test scripts use the runtests function.

To get started, see Write Script-Based Unit Tests.

For more advanced test authoring, including access to many different types of test qualifications, consider writing Function-Based Unit Tests or Class-Based Unit Tests.

Fonctions

assertThrow error if condition false
runtestsRun set of tests
testsuiteCreate suite of tests

Classes

TestResultResult of running test suite

Rubriques