Extend Unit Testing Framework
Customize testing environment; author constraints, diagnostics, fixtures, and plugins
The MATLAB® unit testing framework provides test tool authors the ability to customize the testing environment. You can extend test writing through custom constraints, diagnostics, and fixtures, and extend test running and result reporting through custom plugins for the test runner.
|Fundamental interface class for comparisons|
|Interface class for Boolean combinations of constraints|
|Interface for tolerances|
|Fundamental interface class for diagnostics (renamed from
|Diagnostic with fields common to most constraints|
|Plugin interface for extending TestRunner|
|Interface for plugins that support running tests in parallel|
|Interface for plugins that perform system-wide qualifications|
Data Type Behavior Tests
|Summary of classes in MATLAB Constraints Interface|
|Summary of classes in MATLAB Fixtures Interface|
|Summary of classes in MATLAB Plugins Interface|
- Create Custom Constraint
Create a custom constraint to determine if a given value has the same size as an expected value.
- Create Custom Boolean Constraint
Create a custom Boolean constraint to determine if a given value has the same size as an expected value.
- Create Basic Custom Fixture
Create a basic custom fixture that changes the display format to hexadecimal representation.
- Create Advanced Custom Fixture
Create a configurable fixture that changes the output display format for numeric values.
- Write Plugins to Extend TestRunner
TestRunnerPluginclass to extend the
TestRunner. You can implement methods to extend the creation, setup, running, and teardown of tests or test fixtures.
- Create Custom Plugin
Create a custom plugin that counts the number of passing and failing assertions.
- Run Tests in Parallel with Custom Plugin
Create a custom plugin that counts the number of passing and failing assertions when tests run in parallel.
- Write Plugin to Add Data to Test Results
Create a plugin that adds the actual and expected values in an assertion to the
- Write Plugin to Save Diagnostic Details
This example shows how to create a custom plugin to save diagnostic details. The plugin listens for test failures and saves diagnostic information so you can access it after the framework completes the tests.
- Plugin to Generate Custom Test Output Format
Create a plugin that uses a custom format to write finalized test results to an output stream.