
testing-simulink-models
Tests Simulink models using either ephemeral Gherkin-based tests (modeltest) for quick validation or persistent tests (Simulink Test API) authored from requirements or behavioral specs. Requires Simulink Test.
- Installs
- 124
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill testing-simulink-models- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads testing-simulink-models automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.
When to Use
- Writing pass/fail tests for a Simulink model or subsystem
- Verifying expected behavior against requirements or acceptance criteria
- Creating regression tests to catch future breakage
- Reproducing and validating bug fixes with structured assertions
- Collecting decision coverage metrics
- Authoring persistent tests from linked requirements or a behavioral spec
When NOT to Use
- Building or editing model structure → use
building-simulink-models - Running simulations for data exploration, sweeps, or custom analysis → use
simulating-simulink-models - Querying or resolving parameter values → use
model_query_params/model_resolve_params - Creating or editing requirements → use
generate-requirement-drafts - Injecting faults onto model signals without test authoring → use
inject-faults - FMEA, FHA, FTA, or other safety analysis documents → use
manage-safety-analysis - Simulink Test is not installed → fall back to
simulating-simulink-modelswith manual assertions
Testing Approaches
This 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
Workflow — Gherkin (Quick Validation)
- Understand the component: Use
model_overviewandmodel_readon the target subsystem to identify inputs, outputs, and expected behavior. - Write the
.featurefile: Author a Gherkin test following the syntax inreferences/gherkin-based-fast-testing.md. Start with one scenario covering the primary nominal case. - Cap StopTime before running: Check the model's StopTime with
model_query_params. If it isinf(or unset/auto), you MUST pass a finite stop time tomodel_test— an infinite sim never returns and hangs MATLAB. Pick a finite value that lets the behavior settle (2–30s for a step response). - Run in draft mode: Call
model_testwithdraft_mode='true'for rapid iteration (~3s). Fix syntax or signal errors. - Run full compilation: Once draft passes, re-run with
draft_mode='false'to validate against the actual compiled model (catches type/dimension mismatches). - Expand coverage: Add scenarios for edge cases, fault conditions, and boundary behavior. Use
coverage='decision'to identify untested branches.
Workflow — Simulink Test API (Persistent)
- Understand the component: Use
model_overviewandmodel_readon the target subsystem to identify inputs, outputs, and expected behavior. - Propose test plan → wait for approval: Present what to test, at what scope, and why. Do not call
test_createuntil the engineer approves. - Create test cases: Call
test_createwith the appropriate entry point — component/model only or requirement-driven (RequirementID+ReqSetPath). PassTestFileas an absolute path under the working folder (never a bare filename — it would land in the skill'sscripts/dir, since that is theproject_path). Seereferences/simulink-test-authoring.mdfor call shapes. - Propose test configuration → wait for approval: Present stop time, sim config, signal logging, assessments, and parameter overrides for each test case. Do not call
test_edituntil the engineer approves. Always set a finiteStopTimeviatest_edit— if the model's StopTime isinf(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). - Run and report: Call
test_run, present pass/fail summary with assessment detail. Engineer decides next steps.
Guardrails
Always
- Inspect model (
model_overview/model_read) before writing tests — otherwise you write tests against wrong I/O - Report failures with assessment names, conditions, and signal summaries — users can't diagnose without detail
- Never run a sim or test with StopTime=
inf. Check StopTime before anymodel_test/test_run; if it isinfor 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).
Never
- Guess pass/fail criteria — ask the user if unclear
- Change MATLAB working directory while a model is open — breaks harness cache
References
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 formatsassets/test-structure-template.md— Test structure proposal template (requirement-driven path)assets/test-config-template.md— Test configuration proposal template (requirement-driven path)
Copyright 2026 The MathWorks, Inc.
FAQ
What does the testing-simulink-models skill do?
Tests Simulink models using either ephemeral Gherkin-based tests (modeltest) for quick validation or persistent tests (Simulink Test API) authored from requirements or behavioral specs. Requires Simulink Test.
How do I install testing-simulink-models?
Run npx skills add https://github.com/matlab/simulink-agentic-toolkit --skill testing-simulink-models in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/testing-simulink-models/ (personal) or .claude/skills/testing-simulink-models/ (project).
Which AI agents can use testing-simulink-models?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is testing-simulink-models safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains testing-simulink-models?
It is published by matlab in matlab/simulink-agentic-toolkit. It has 124 recorded installs.
More from matlab/simulink-agentic-toolkit
building-simulink-models
matlab/simulink-agentic-toolkit
Builds and edits Simulink, System Composer, Stateflow, and Simscape models. Use when modifying model structure, parameters, ports, connections, or Stateflow chart internals.
simulating-simulink-models
matlab/simulink-agentic-toolkit
Configures Simulink simulations non-destructively using SimulationInput objects — parameter overrides without modifying the model, batch sweeps via parsim, custom input signals via Dataset, and simulation data retrieval via logsout. Use when running sim()/parsim() with setVariable, setBlockParameter, setExternalInput, or when performing parameter sweeps and multi-run analysis. Not needed for one-shot simulations without configuration.
specifying-plant-models
matlab/simulink-agentic-toolkit
Specify plant models for closed-loop simulation: system specs, architecture, build plans, validation plans. Use when creating, updating, or reviewing plant model specifications, planning plant model architecture, or planning plant model validation.
specifying-mbd-algorithms
matlab/simulink-agentic-toolkit
Specify algorithms for Model-Based Design: system specs, architecture specs, implementation plans, test plans. Use when creating specifications for controllers, signal processing, diagnostics, estimators, or other algorithms authored in Simulink, Stateflow, System Composer, or MATLAB Function blocks.
generate-requirement-drafts
matlab/simulink-agentic-toolkit
Generates draft requirements from Simulink models. Use when drafting or updating requirement artifacts from a model. Prefers Requirements Toolbox (.slreqx) when available; falls back to structured YAML.
filing-bug-reports
matlab/simulink-agentic-toolkit
Generate a standalone bug report that another developer can use to reproduce, investigate, and fix an issue. Use when the user says 'file a bug', 'write a bug report', 'report this issue', or asks to document a defect for handoff.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work