SKILL18.4K installs530

Dart Generate Test Mocks

Define and generate mock objects for external dependencies using `package:mockito` and `build_runner`. Use when unit testing classes that depend on complex external services like APIs or databases.

Type
Skill
Author
dart-lang
Category
Testing
GitHub stars
530
Installs
18.4K
Last updated
October 16, 2026

Install

npx skills add https://github.com/dart-lang/skills --skill dart-generate-test-mocks

Use cases


Frequently Asked Questions

Which packages does this skill use?

package:mockito for mock objects and build_runner for code generation.

When should I reach for it?

When unit testing classes that depend on complex external services like APIs or databases.

Does it cover code generation as well as writing mocks?

Yes — it covers both defining the mocks and running the generation step.


About this skill

Defines and generates mock objects for external dependencies with package:mockito and build_runner. Use it when unit testing classes that depend on APIs, databases, or other complex services. It covers both writing the mock definitions and running the code generation.

Summary written with AI assistance from the project's public description.


Categories


More from dart-lang


Similar Skills