nelson.unittest.run
Run tests through the modern test runner.
📝Syntax
results = nelson.unittest.run(targets, Name, Value)
results = nelson.unittest.run(plan, Name, Value)
📥Input Arguments
Parameter Description
targets module name, directory, file name, cell array of targets, TestSuite, or TestPlan.
Name, Value execution options: Workers, Timeout, StopOnFail, Retry, RetryOnlyOn, LogDir, Format, OutputFile, and Launcher.
📤Output Arguments
Parameter Description
results TestRunResult structure with status, summary, normalized cases, diagnostics, registry, and raw compatibility data.
📄Description

nelson.unittest.run executes each test or bench in a supervised child process. There is no in-process execution mode for tests or benches.

Tests and benches run in separated child processes by default. A file can authorize process reuse with the <--REUSE PROCESS--> tag.

The native supervisor uses a dynamic weighted queue. The optional <--WEIGHT N--> tag gives heavier files priority without changing their stable display order.

The optional <--TIMEOUT N--> tag overrides the per-file execution timeout (in seconds) for a single file; the global Timeout option, when set, still takes precedence.

Results are displayed progressively in discovery order as soon as the preceding results are available. Each line includes its status and elapsed time.

If a reusable worker crashes or returns no result, the runner retries the affected test once with the isolated fallback path. A timeout is reported directly.

Without a GUI or ADV-CLI tag, the isolated launcher is nelson-cli, including when the parent process is graphical.

The Launcher option selects the graphics backend for ADV-CLI-tagged tests: 'default' (the historical executables) or 'webview', which runs those tests through nelson-adv-cli --webview so figures are rendered by the headless web (RenderWeb) backend. CLI and GUI tags are unaffected. The selection is also read from the NELSON_UNITTEST_LAUNCHER environment variable, which is convenient for continuous integration.

💡Examples
results = nelson.unittest.run('core', 'Workers', 4, 'Format', 'json', ...
  'OutputFile', [tempdir(), 'core.json']);
🔗See Also
test_runnelson.unittest.reportnelson.unittest.tuneWeightsnelson.unittest.tuneReuse
Edit this page on GitHub