Dart Add Unit Test
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
- Type
- Skill
- Author
- dart-lang
- Category
- Testing
- GitHub stars
- 530
- Installs
- 19.3K
- Last updated
- October 16, 2026
Install
npx skills add https://github.com/dart-lang/skills --skill dart-add-unit-testUse cases
- Add unit tests for a new Dart function before opening a pull request.
- Cover a bug fix with a regression test to prevent it from returning.
- Organize existing tests into groups for a class you just refactored.
Frequently Asked Questions
Which test package does this skill use?
It writes tests with package:test, so your Dart project needs that dependency already set up.
When should I run it?
Use it when adding new logic or fixing bugs, so changes stay covered against regressions.
Does it work for classes as well as functions?
Yes, it covers functions, methods, and classes.
About this skill
Writes and organizes unit tests for functions, methods, and classes using package:test. Use it when adding new logic or fixing bugs, so changes stay covered against regressions. It targets Dart projects already set up with package:test.
Summary written with AI assistance from the project's public description.
Categories
More from dart-lang
Dart Run Static Analysis
Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during deve...
by dart-lang
Dart Use Pattern Matching
Use switch expressions and pattern matching where appropriate
by dart-lang
Dart Fix Runtime Errors
Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.
by dart-lang
Dart Resolve Package Conflicts
Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.
by dart-lang
Similar Skills
Find Skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", o...
by vercel-labs
Grill Me
A relentless interview to sharpen a plan or design.
by mattpocock
Ai Video Generation
Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0,...
by inference-sh
Ai Image Generation
Generate AI images with GPT-Image-2, FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: GPT-Image-2, FLUX Dev LoRA, FL...
by inference-sh