matlab/testing-simulink-models
Tests Simulink models using either ephemeral Gherkin-based tests (model_test) for quick validation or persistent tests (Simulink Test API) authored from requirements or behavioral specs. Requires Simulink Test.
npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill testing-simulink-models
Requires Simulink Test and R2023a or later. The requirement-driven entry point also requires Requirements Toolbox. The coverage workflow also requires Simulink Coverage. If Simulink Test is unavailable, use simulating-simulink-models with manual assertions.
building-simulink-modelssimulating-simulink-modelsmodel_query_params / model_resolve_paramsgenerate-requirement-draftsinject-faultsmanage-safety-analysissimulating-simulink-models with manual assertionsThis skill provides two testing approaches. Choose based on task context:
| | Gherkin (model_test) | Simulink Test API (test_create family) |
|---|---|---|
| Persistence | Ephemeral — harness discarded after session | Persistent — .mldatx files remain in project |
| Speed | ~3s (draft mode) | ~60s (full Simulink Test infrastructure) |
| Traceability | None | Full requirement linking via .slreqx |
| Use case | Bug fixes, quick validation, agentic loop | Certification, systematic testing, formal V&V; also takes behavioral specs |
| Approval needed | No | Yes — engineer reviews test plan before execution |
| Coverage | coverage parameter ('none' or 'decision') | Via test_run options |
| Toolbox | Simulink Test | Simulink Test (+ Requirements Toolbox for requirement path) |
→ For Gherkin testing, read references/gherkin-based-fast-testing.md
→ For Simulink Test API authoring (requirements / behavioral spec), read references/simulink-test-authoring.md
model_overview and model_read on the target subsystem to identify inputs, outputs, and expected behavior..feature file: Author a Gherkin test following the syntax in references/gherkin-based-fast-testing.md. Start with one scenario covering the primary nominal case.model_query_params. If it is inf (or unset/auto), you MUST pass a finite stop time to model_test — an infinite sim never returns and hangs MATLAB. Pick a finite value that lets the behavior settle (2–30s for a step response).model_test with draft_mode='true' for rapid iteration (~3s). Fix syntax or signal errors.draft_mode='false' to validate against the actual compiled model (catches type/dimension mismatches).coverage='decision' to identify untested branches.model_overview and model_read on the target subsystem to identify inputs, outputs, and expected behavior.test_create until the engineer approves.test_create with the appropriate entry point — component/model only or requirement-driven (RequirementID + ReqSetPath). Pass TestFile as an absolute path under the working folder (never a bare filename — it would land in the skill's scripts/ dir, since that is the project_path). See references/simulink-test-authoring.md for call shapes.test_edit until the engineer approves. Always set a finite StopTime via test_edit — if the model's StopTime is inf (or unset), the test run never returns and hangs MATLAB. Choose a finite value that lets the behavior settle (2–30s for a step response).test_run, present pass/fail summary with assessment detail. Engineer decides next steps.model_overview / model_read) before writing tests — otherwise you write tests against wrong I/Oinf. Check StopTime before any model_test/test_run; if it is inf or unset, override it with a finite value first. An infinite sim never returns and hangs the MATLAB session (and, in a shared session, every subsequent task).references/gherkin-based-fast-testing.md — Gherkin syntax, draft mode, coverage, Simscape constraintsreferences/simulink-test-authoring.md — API manual: setup, constraints, test_create entry shapes, edit/read/run signaturesreferences/assessment-format.md — LoggedSignals and Assessments struct formatsreferences/test-structure-template.md — Test structure proposal template (requirement-driven path)references/test-config-template.md — Test configuration proposal template (requirement-driven path)----
Copyright 2026 The MathWorks, Inc.
----
Take matlab/testing-simulink-models from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.