Run tests
Desktop finds the MATLAB-style tests in a project, runs them and opens a report with each test's result. It uses the same test runner as runmat test on the command line, so a test that passes in Desktop passes in CI with the same inputs.
Set up the project
Desktop looks for tests in the project's source roots. Name them in runmat.toml at the project root:
[package]
name = "weights"
[sources]
roots = ["src", "tests"]Keep functions in src/ and tests in tests/. Source roots can't overlap, so list sibling folders rather than "." and a folder inside it.
A function-based test file returns its local test functions:
% tests/test_build_weights.m
function tests = test_build_weights
tests = functiontests(localfunctions);
end
function test_nonnegative(testCase)
w = build_weights([1, -2, 3, 4]);
verifyTrue(testCase, all(w >= 0));
end
function test_sums_to_one(testCase)
w = build_weights([1, 2, 3, 4]);
verifyEqual(testCase, sum(w), 1, "AbsTol", 1e-12);
endScript-based and class-based tests work too. See runmat test.
Run the tests
- Open the Run menu with the ⌄ beside the Run button.
- Select Run all tests, or Run selected tests… to pick tests from a list.

When the run finishes, a Test results tab opens with the report:
- the status and how many tests finished, for example
Completed · 2 of 2 tests finished; - a summary of passed, failed and remaining tests;
- a row per test with its status and the number of attempts; select a test's name to open it;
- line coverage of the project's source;
- the generated report files (text, JSON and JUnit XML), which you can open or attach to a review.
The report is a Markdown file under .artifacts/test-runs/ in the project, so earlier reports stay in the file tree. Settings › Project › Hide internal files hides that folder from the tree.
Fix a failing test
- In the report, select the failed test to open it.
- Read the failed check and the values it compared.
- Fix the function or the test, then run the tests again.
Keep fixtures small and deterministic: seed random inputs and compare floating-point results with a tolerance that suits the calculation, as AbsTol does above.
Match CI
Before you push a change:
- Save all files.
- Run all tests from the Run menu.
- Run the same suite with
runmat testin a clean checkout, the way CI will.
When Desktop and CI disagree, compare the RunMat version, operating system, runmat.lock, environment variables and where the tests ran. See Packages in CI.
Packages
Not yet releasedStatus A Packages view in the sidebar lists the project's dependencies from runmat.toml, restores missing versions after you clone or open a project, and adds packages from the RunMat registry or an allowed local source. Until it ships, manage dependencies with the CLI; see Packages.
