Main Content

Class-Based Unit Tests

Write class-based tests; parameterize tests; apply fixtures; select and run tests

Write xUnit-style tests to check that the output of MATLAB® code is as you expect. Class-based unit tests give you access to the full unit testing framework functionality. For example, you can write parameterized tests, tag your tests, or use shared test fixtures.

To get started, see Author Class-Based Unit Tests in MATLAB and Write Simple Test Case Using Classes.

Funktionen

runtestsRun set of tests
testsuiteCreate suite of tests
testrunnerCreate test runner
run (TestSuite)Run TestSuite array using TestRunner object configured for text output
run (TestRunner)Run test suite
run (TestCase)Run TestCase test
runInParallelRun all tests in TestSuite array in parallel

Klassen

matlab.unittest.TestCaseSuperclass of all matlab.unittest test classes
matlab.unittest.TestSuiteFundamental interface for grouping tests to run
matlab.unittest.TestSpecification of a single test
matlab.unittest.TestRunnerClass for running tests in matlab.unittest framework
matlab.unittest.TestResultResult of running test suite

Pakete

matlab.unittestSummary of packages and classes in MATLAB Unit Test Framework
matlab.unittest.qualificationsSummary of classes in MATLAB Qualifications Interface
matlab.unittest.constraintsSummary of classes in MATLAB Constraints Interface
matlab.unittest.diagnosticsSummary of classes in MATLAB Diagnostics Interface
matlab.unittest.fixturesSummary of classes in MATLAB Fixtures Interface
matlab.unittest.parametersSummary of classes associated with MATLAB Unit Test parameters
matlab.unittest.pluginsSummary of classes in MATLAB Plugins Interface
matlab.unittest.selectorsSummary of classes in MATLAB Selectors Interface
Simulink.sdi.constraints.MatchesSignalConstraint that compares time series data with tolerances using the Simulation Data Inspector

Themen

Write Tests

Write Parameterized Test

Run Tests and Analyze Results