Skip to content

matlab.unittest.TestCase

matlab · scripts/+matlab/+unittest/TestCase.m

: TestCase

Base class for MATLAB unit tests.

This class provides the foundation for writing unit tests compatible with MATLAB’s unit testing framework. Test classes should inherit from matlab.unittest.TestCase.

classdef MyTest < matlab.unittest.TestCase
  methods (Test)
    function testSomething (testCase)
      testCase.verifyEqual (1 + 1, 2);
    end
  end
end

Wall-clock limit (nexus#1917 / nw ti2-004): a test class may declare an ordinary instance property TestTimeout (seconds). The Nexus runtests runner fails the test when measured Duration exceeds that value. Omit the property (or set a non-finite value) for no limit.

MATLAB R2026a decision: there is no TestTimeout attribute (Illegal attribute 'TestTimeout'), and MATLAB does not enforce a plain property of that name. Nexus keeps the MATLAB-legal property surface (opt-in on the subclass, not on this base class) and adds post-run enforcement for the backlog wall-time behaviour.