Unit Testing
33
Write Test Using Live Script ....................... 33-3
Write Script-Based Unit Tests ..................... 33-6
Write Script-Based Test Using Local Functions...... 33-13
Extending Script-Based Tests..................... 33-17
Test Suite Creation........................... 33-17
Test Selection............................... 33-18
Programmatic Access of Test Diagnostics .......... 33-19
Test Runner Customization..................... 33-19
Run Tests in Editor............................. 33-21
Write Function-Based Unit Tests.................. 33-25
Create Test Function......................... 33-25
Run the Tests ............................... 33-28
Analyze the Results.......................... 33-28
Write Simple Test Case Using Functions............ 33-30
Write Test Using Setup and Teardown Functions ..... 33-35
Extending Function-Based Tests.................. 33-42
Fixtures for Setup and Teardown Code............ 33-42
Test Logging and Verbosity ..................... 33-43
Test Suite Creation........................... 33-44
Test Selection............................... 33-44
Test Running ............................... 33-45
Programmatic Access of Test Diagnostics .......... 33-45
Test Runner Customization..................... 33-46
Author Class-Based Unit Tests in MATLAB.......... 33-47
The Test Class Definition...................... 33-47
The Unit Tests.............................. 33-47
Additional Features for Advanced Test Classes...... 33-49
Write Simple Test Case Using Classes.............. 33-51
xxxv