simulink-test-sequence-from-ears
/simulink-test-sequence-from-ears
Generate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.
- Author
- matlab ↗
- Repository
- agent-skills-playground ↗
- Licence
- BSD-2-Clause
- Last repository change
- 14.10.2026
Assessment and security
- Files in this package
- 21
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 14.10.2026, without references to retired models or APIs.
BSD-2-Clause, otwarta.
What it does and when to use it
Generate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.
Original author description
Generate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.
How it works
- Core rules
- Setup and inputs
- Phase 1: Review the mappings
- Phase 2: Generate and inspect
- Supported patterns and limits
- Supporting functions
SKILL.md preview
---
name: simulink-test-sequence-from-ears
description: Generate Simulink Test Sequence blocks and harnesses from EARS requirements. Use when asked to create a test case from a requirement, generate tests from a .slreqx file, or verify a Simulink model with requirement-based tests.
license: MathWorks license (see LICENSE.md)
compatibility: Requires MATLAB, Simulink, Simulink Test, and Requirements Toolbox. Stateflow is needed for chart discovery and the ModeLogic demo. The supplied example targets R2026a or newer.
metadata:
author: MathWorks
version: "1.0"
---
# Simulink Test Sequences from EARS Requirements
Map requirement phrases to model signals, review the mappings, and generate
Test Sequence harnesses with the bundled MATLAB helpers.
## Core rules
- Start with a YAML mapping review. Use an existing explicit approval when
available; do not infer approval from a filename or from a mapping appearing
obvious.
- Scope the review and generation to the requested requirement IDs.
- Resolve open questions about signals, units, enum values, precondition paths,
and timing before generating tests. Include complete initialization,
stimulus, and `verify()` statements.
- Associated harness creation saves registration metadata on the owner model.
Use a writable working copy for demos. Explain this effect when preparing
generation against a user's model.
- Inspect per-requirement warnings and compile results. The generator can
continue after a harness fails; the final completion message and presence of
a `.slx` file do not establish success.
- Compilation is not test execution. Run the generated test when requested,
and distinguish a compile check from simulation and assertion results.
## Setup and inputs
Identify the model under test, the `.slreqx` requirement set, and any
`.sldd` dictionaries or enumeration classes. Resolve the folder containing
this file as `skillRoot`, then add `fullfile(skillRoot, "scripts")` to the
MATLAB path.
Run MATLAB from the model artifacts folder (or set the evaluation tool's
working-folder option). Discovery scans that folder for dictionaries and enum
classes. Verify `which("analyzeRequirements")` resolves to this installation.
The older `analizeRequirements` spelling remains a compatibility alias.
## Phase 1: Review the mappings
Use `analyzeRequirements(modelName, reqSetPath)` for requirement and model
discovery. For a review of selected requirements:
```matlab
review = generateMappingReviewFromRequirements( ...
'ModeLogic', 'HLR_ModeLogic_EARS.slreqx', ...
'mapping_review_req17.yaml', 'RequirementIds', "17");
```
Read [workflow-details.md](references/workflow-details.md) when constructing or
editing the YAML. Lead with `phrase_mappings` containing the requirement
phrase, model element, and interpretation. Keep generation fields in the same
file: `init_assignments`, `precondition_path`, `stimulus_assignments`, and
`verify_statements`.
Record assumptions in `test_assumptions`, unresolved meanings in
`open_questions`, and approval in `status`. Show the final review file in
the MATLAB Editor when available, unless the user requests otherwise. For
headless operation or intermediate files, pass `'OpenInEditor', false`.
Present a short mapping summary and request review when approval is missing.
After the user approves, set the accepted entries to `status: 'approved'`.
Edits with unresolved questions do not constitute approval.
## Phase 2: Generate and inspect
```matlab
result = buildHarnessesFromApprovedYaml( ...
'ModeLogic', 'mapping_review_req17.yaml');
```
The default creates externally saved harnesses in `test_harnesses/` and
registers them on the source model. If the requested output is standalone
harness files, the staged alternative is:
```matlab
result = buildHarnessesFromApprovedYaml( ...
'ModeLogic', 'mapping_review_req17.yaml', ...
'AssociateWithSourceModel', false);
```
That alternative generates in a temporary workspace and copies harness files
back; it does not register them on the source model. Inspect the reported
build folder when troubleshooting dictionary or model shadowing.
Open the generated harness and relevant `result.test_sequence_blocks` when
a desktop session is available and the user has not requested headless work.
Use the returned paths to inspect the Test Sequence. Do not recreate the
bundled helpers.
## Supported patterns and limits
| EARS pattern | Form | Generated steps |
|---|---|---|
| Ubiquitous | The system shall ... | Initialize and verify |
| Event-driven | When ..., the system shall ... | Establish preconditions, trigger, verify |
| State-driven | While ..., the system shall ... | Establish the state and check behavior |
| Unwanted behavior | If ..., then the system shall ... | Apply the condition and check the response |
| Optional | Where ..., the system shall ... | Use the event-driven configurator |
The parser recognizes these sentence forms; arbitrary natural-language
requirements may need clarification. Automated phrase and precondition
inference includes ModeLogic-specific heuristics, so review mappings against
the actual system. The bundled timing defaults and one scenario per
requirement do not establish exhaustive verification.
Requirements Toolbox traceability links must be added separately through
Simulink Test Manager. Do not claim certification, standards compliance, or
complete requirement coverage from generated harnesses.
## Supporting functions
[Workflow details](references/workflow-details.md) includes the YAML schema,
a ModeLogic example, the low-level `signalMappings` struct, and the helper
catalog. Use it for custom mappings and multi-step preconditions.
Copyright 2026 The MathWorks, Inc.
Files in this package (21)
- LICENSE.md 1 KB
- SKILL.md 6 KB
- references/workflow-details.md 15 KB
- scripts/addPreconditionSteps.m 1 KB
- scripts/analizeRequirements.m 3 KB
- scripts/analyzeRequirements.m 1 KB
- scripts/buildHarnessesFromApprovedYaml.m 7 KB
- scripts/collectSkillContext.m 30 KB
- scripts/compileHarnessModel.m 1 KB
- scripts/configureEventDriven.m 2 KB
- scripts/configureStateDriven.m 2 KB
- scripts/configureTestSequence.m 2 KB
- scripts/configureUbiquitous.m 1 KB
- scripts/configureUnwantedBehavior.m 2 KB
- scripts/generateMappingReviewFromRequirements.m 30 KB
- scripts/generateSignalMappingsFromYaml.m 4 KB
- scripts/generateTestSequencesFromRequirements.m 5 KB
- scripts/parseEARSPattern.m 2 KB
- scripts/prepareWritableBuildWorkspace.m 2 KB
- scripts/readMappingReviewYaml.m 7 KB
- scripts/writeMappingReviewYaml.m 9 KB
Versions
The database has no other skills named simulink-test-sequence-from-ears.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version 975f7f9a1939 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100generate-requirement-drafts
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. - 100generate-requirement-drafts
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. - 100simulink-model-check
Audit a Simulink model's structure and explain its architecture. Use when the user says 检查模型 / 看看这个模型有什么问题 / model health / why does the build or compile fail, or before editing a model you have not seen. - 95simulink-requirements
Use this skill for all requirements-related work in a MATLAB MBSE project using the Requirements Toolbox (slreq). Covers creating and populating requirement sets, derivation links, test case requirements, verification coverage, reading and tracing links across requirement sets… - 95simulink-automation
Use when working with Simulink models — analyzing topology, inspecting parameters, modifying values, or managing model lifecycle via MATLAB Engine. - 100testing-simulink-models
Creates persistent Gherkin-based pass/fail tests for Simulink models and individual subsystems using model_test. Use when verifying expected behavior, writing regression tests, reproducing issues, or validating bug fixes with structured assertions. Requires Simulink Test.