matlab-test-generator

Generate MATLAB unit tests using the MATLAB Testing Framework.

162|31|Updated Oct 25, 2025
One-click install
npx skills add https://github.com/matlab/skills --skill matlab-test-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: matlab-test-generator
Source: https://github.com/matlab/skills/tree/main/skills/matlab-test-generator
Command: npx skills add https://github.com/matlab/skills --skill matlab-test-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidelines and templates for creating robust unit tests using the MATLAB Testing Framework. It helps developers generate test classes, test methods, and test suites to ensure MATLAB code correctness.

Core Features & Use Cases

  • Generate test classes, test methods, and test suites following MATLAB best practices
  • Support for class-based, function-based, and script-based tests using matlab.unittest
  • Parameterized tests, fixtures, and setup/teardown routines for reliable testing
  • Clear test organization with conventional naming and placement under tests/

Quick Start

Use the matlab-test-generator skill to create a test for a MATLAB function named myFunction by invoking the generator with the function name and desired test scope (class-based or function-based).

Frequently Asked Questions about matlab-test-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate MATLAB unit tests using the matlab.unittest framework?

To generate MATLAB unit tests, you create class-based, function-based, or script-based test files using the matlab.unittest framework. This process involves defining test classes, test methods, and test suites to validate your MATLAB code correctness.

What is the best way to structure parameterized tests and fixtures in MATLAB?

The best way to structure parameterized tests and fixtures in MATLAB is by using TestCase-based assertions and setup/teardown routines. This ensures reliable testing and clear test organization with conventional naming and proper file placement under the tests/ directory.

Can I use this MATLAB testing framework for both function-based and script-based tests?

Yes, the MATLAB testing framework supports class-based, function-based, and script-based tests. You can generate test methods and suites across these formats to validate functions, classes, and general MATLAB code.

How do I create a test class for a specific MATLAB function?

To create a test class for a MATLAB function, invoke the generator with the function name and desired test scope. The generator applies TestCase-based assertions to validate the function and automatically handles correct file naming conventions for Test files.

When do I need to use setup and teardown routines in MATLAB test suites?

You need to use setup and teardown routines in MATLAB test suites when managing test fixtures to ensure reliable testing. These routines prepare the environment before test methods run and clean up afterward, maintaining state isolation across parameterized tests.

Does generating MATLAB unit tests require specific file naming conventions?

Yes, generating MATLAB unit tests requires correct file naming conventions for Test files placed under the tests/ directory. Adhering to these conventions ensures the matlab.unittest framework properly recognizes and executes the test suites.