MATLAB unit test writer
Give it MATLAB code. Get class-based unit tests with fixtures, mocks and app tests that you can run.
MATLAB unit test writer is a free AI skill for the job "Test and fix code". Give the instructions to an AI assistant that supports the required files and tools, then review its output.
Free · No account · BSD 2 Clause licence · Made by MathWorks
Made by MathWorks. See the original on GitHub; we copied it as it is, with its licence.
What it does
A set of MATLAB unit tests you can run today, written as classes with edge cases covered. Give it your code and get tests that check what it does, not how it does it. For anything bigger than a small function it shows you a plan first: the test methods, the edge cases and any parameter ranges, for your approval. Then it writes the tests. They follow firm rules. Every test is a class, never a script. No test contains an if, a loop or a try, and each follows arrange, act, assert. Tests use public interfaces only. It covers fixtures, mocks and app tests as well. After writing, it runs the tests through MATLAB to confirm they pass.
You give it
- The code to test
- Expected behaviours and error cases
- Any outside services to fake (optional)
- MATLAB release
You get
- A test plan to approve
- Class-based test files
- Fixtures and mocks where needed
- A passing test run
Use it when
- You have functions with no tests and want a safety net before changing them.
- You need tests for a class with several input types.
- You want to test an app without clicking through it each time.
- You need mocks so a test does not call a real service.
How to use it
- Add it to your AI once: download it and add the folder to Claude, ChatGPT or Codex as a skill.
- Ask for the job in your own words. Your AI opens the skill when it fits.
- It works best when your AI can run MATLAB.