Script-Based Unit Tests
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
To get started, see Write Script-Based Unit Tests.
|Result of running test suite|
- Write Test Using Live Script
This example shows how to write a live script that tests a function that you create.
- Write Script-Based Unit Tests
Write a script to test a function that you create.
- Write Script-Based Test Using Local Functions
This example shows how to write a script-based test that uses local functions as helper functions.
- Analyze Test Case Results
This example shows how to analyze the information returned by a test runner.
- Analyze Failed Test Results
This example shows how to identify and handle failed tests.
- Rerun Failed Tests
Rerun failed tests quickly and conveniently.
- Extend Script-Based Tests
Access additional functionality using script-based tests, including test selection, programmatic access of test diagnostics, and test runner customization.
- Ways to Write Unit Tests
Choose a test authoring scheme that best suits your requirements and your preferred workflow.