技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
matlab-run-tests【数据与研究】Run MATLAB test suites and analyze results, including test filtering, parallel execution, result diagnostics, code coverage collection, gap analysis, and CI/CD with buildtool. Use when running tests, filtering test suites, analyzing test failures, checking, collecting, or analyzing coverage, justifying uncovered code, or configuring CI pipelines. Do …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Run MATLAB test suites, analyze results, collect code coverage metrics, and configure CI/CD pipelines using matlab.unittest infrastructure.
matlab-write-testsmatlab-write-testsmatlab-software-development:matlab-create-buildfilerun_matlab_test_file MCP tool or runtests with filteringTestRunner with CodeCoveragePlugin and CoverageResultcoverageSummary and present percentages to userTestTask with source and report optionsUse the run_matlab_test_file MCP tool to run test files directly. When you need filtering, parallel execution, or other options, use evaluate_matlab_code with runtests:
results = runtests('tests'); % all tests in folder
results = runtests('tests', Tag='Unit'); % by tag
results = runtests('tests', Name='*Calculator*'); % by name pattern
results = runtests('tests', UseParallel=true); % parallel execution
results = runtests('tests', Strict=true); % warnings = failures
disp(results);
for r = results([results.Failed])
fprintf('\nFAILED: %s\n', r.Name);
disp(r.Details.DiagnosticRecord.Report);
end
for r = results([results.Incomplete])
fprintf('\nINCOMPLETE: %s\n', r.Name);
disp(r.Details.DiagnosticRecord.Report);
end
import matlab.unittest.TestRunner
import matlab.unittest.plugins.CodeCoveragePlugin
import matlab.unittest.plugins.codecoverage.CoverageResult
runner = TestRunner.withTextOutput;
covFormat = CoverageResult;
runner.addPlugin(CodeCoveragePlugin.forFolder('src', ...
IncludingSubfolders=true, Producing=covFormat, MetricLevel='mcdc'));
results = runner.run(testsuite('tests'));
covResults = covFormat.Result;
summary = coverageSummary(covResults, "mcdc");
fprintf('Coverage: %d/%d (%.1f%%)\n', sum(summary(:,1)), sum(summary(:,2)), ...
100*sum(summary(:,1))/sum(summary(:,2)));
For detailed coverage workflows — gap analysis, justifications, generated C code coverage, and data type/size coverage — see references/code-coverage-guidance.md.
| Category | Functions | Purpose |
|---|---|---|
| Execution | runtests, TestSuite, TestRunner | Run and organize tests |
| Coverage | CodeCoveragePlugin, CoverageResult, coverageSummary | Measure test coverage |
| Reports | CoverageReport, generateStandaloneReport, generateCoberturaReport | Coverage output formats |
| CI/CD | buildtool, TestTask, addCodeCoverage | Pipeline automation |
| Scripts | printCoverageGaps | Print all uncovered items across metric levels — see references/code-coverage-guidance.md for interface |
Use buildtool with a buildfile.m for CI pipelines. See references/test-execution-guidance.md for buildfile.m templates and CI configs (GitHub Actions, Azure DevOps, GitLab CI).
Load these on demand — most test runs only need what's in this file.
| Load when... | Reference |
|---|---|
| Running tests in CI, buildtool config, filtering options, parallel execution details | references/test-execution-guidance.md |
| Collecting code coverage (MC/DC, statement, decision, condition), analyzing gaps, justifying uncovered code, generated C code coverage, type-size coverage | references/code-coverage-guidance.md |
| Creating or modifying filter rule XML for coverage justifications | references/justification-filter-rules.md |
| Extracting data type and size coverage results from hidden property | references/datatype-size-extraction.md |
run_matlab_test_file MCP tool when possibleforFolder with IncludingSubfolders=true as the default source specification for coverageCoverageResult as the only format — always use it as the primary programmatic formatCopyright 2026 The MathWorks, Inc.