-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Add documentation for overarching tests in flutter, add skill to help agents figure out where tests go #185148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
auto-submit
merged 12 commits into
flutter:master
from
reidbaker:r-testing-overview-2026-04-16
Apr 28, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fbf141d
Add documentation for overarching tests in flutter, add skill to help…
reidbaker 6f12bf4
Remove trailing space
reidbaker 1b5fe04
Delete .agents/skills/testing-guidance/SKILL.md
reidbaker 6b1229d
remove codeowners entry for deleted skill
reidbaker d850251
Merge branch 'master' into r-testing-overview-2026-04-16
reidbaker 4940f9c
Update relative path links
reidbaker 3e8c9cb
Apply suggestions from code review
reidbaker ddec516
Update docs/contributing/testing/Test-Types-Overview.md
reidbaker a1da769
Apply suggestions from code review
reidbaker d06cbf6
Merge remote-tracking branch 'origin/master' into r-testing-overview-…
reidbaker b4f2b2e
Updated testing documentation with code review feedback, sub second c…
reidbaker a2f6282
tools description
reidbaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Flutter Codebase Test Inventory | ||
|
|
||
| This file lists and categorizes the test files found in the Flutter codebase. | ||
| Due to the large number of tests (over 6000 files), they are grouped by category and location. | ||
|
|
||
| ## Runtime Length | ||
| - **Sub-second**: < 1 second (Simple unit tests, e.g., in `dev/tools`) | ||
| - **Fast**: < 10 seconds (Most unit tests, simple widget tests) | ||
| - **Medium**: 10-60 seconds (Complex widget tests, some tool tests) | ||
| - **Slow**: > 60 seconds (Integration tests, devicelab tasks, analyze script) | ||
|
|
||
| ## Groupings | ||
|
|
||
| ### 1. Framework Tests | ||
| - **Location**: `packages/flutter/test/` | ||
| - **Language**: Dart | ||
| - **Description**: Unit and Widget tests for the Flutter framework. | ||
| - **Documentation**: | ||
| - [Running-and-writing-tests.md](Running-and-writing-tests.md) | ||
| - [Writing-a-golden-file-test-for-package-flutter.md](Writing-a-golden-file-test-for-package-flutter.md) | ||
| - [Leak-tracking.md](Leak-tracking.md) | ||
| - **Run Locally**: Yes. | ||
| - **Commands**: | ||
| - Run all tests in a directory: `bin/flutter test packages/flutter/test/foundation` | ||
| - Run a specific test: `bin/flutter test packages/flutter/test/foundation/assertions_test.dart` | ||
| - **Speed**: Fast (< 10 seconds) for individual tests when environment is working. | ||
|
reidbaker marked this conversation as resolved.
|
||
| - **Count**: ~1000+ files. | ||
|
reidbaker marked this conversation as resolved.
|
||
|
|
||
| ### 2. Tool Tests | ||
| - **Location**: `packages/flutter_tools/test/` | ||
| - **Language**: Dart | ||
| - **Description**: Where the flutter tool tests live. | ||
| - **Documentation**: [README.md](../../../packages/flutter_tools/README.md) | ||
| - **Run Locally**: Yes. | ||
| - **Commands**: | ||
| - Run general unit tests: `bin/flutter test packages/flutter_tools/test/general.shard` | ||
| - Run a specific test: `bin/flutter test packages/flutter_tools/test/general.shard/base_utils_test.dart` | ||
| - Run integration tests: `bin/flutter test packages/flutter_tools/test/integration.shard` (Requires `FLUTTER_ROOT` environment variable). | ||
|
reidbaker marked this conversation as resolved.
|
||
| - **Speed**: Fast (< 10 seconds) for general shard tests, Medium to Slow for integration tests. | ||
| - **Count**: ~500+ files. | ||
|
|
||
| ### 3. DeviceLab Tests | ||
| - **Location**: `dev/devicelab/` | ||
| - **Language**: Dart | ||
| - **Description**: Performance and integration tests run in the Flutter DeviceLab. | ||
| - **Documentation**: | ||
| - [README.md](../../../dev/devicelab/README.md) | ||
| - [How-to-write-a-memory-test-for-Flutter.md](How-to-write-a-memory-test-for-Flutter.md) | ||
| - [How-to-write-a-render-speed-test-for-Flutter.md](How-to-write-a-render-speed-test-for-Flutter.md) | ||
| - **Run Locally**: Partially. May require a physical device or emulator and specific environment setup (e.g., `ANDROID_SDK_ROOT`). | ||
| - **Commands**: | ||
| - Run a task: `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t {NAME_OF_TEST}` (Run from `dev/devicelab`). | ||
| - Example: `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t complex_layout__start_up` | ||
| - **Speed**: Slow (> 60 seconds). | ||
| - **Count**: ~100+ files. | ||
|
|
||
| ### 4. Benchmarks | ||
| - **Location**: `dev/benchmarks/` | ||
| - **Language**: Dart | ||
| - **Description**: Performance benchmarks. | ||
| - **Documentation**: | ||
| - [README.md](../../../dev/devicelab/README.md) (Benchmarks are run as DeviceLab tasks). | ||
| - [How-to-write-a-memory-test-for-Flutter.md](How-to-write-a-memory-test-for-Flutter.md) | ||
| - [How-to-write-a-render-speed-test-for-Flutter.md](How-to-write-a-render-speed-test-for-Flutter.md) | ||
| - **Run Locally**: Partially, same requirements as DeviceLab tests. | ||
| - **Commands**: See DeviceLab Tests. | ||
| - **Speed**: Slow (> 60 seconds). | ||
| - **Count**: ~160+ files. | ||
|
|
||
| ### 5. Analysis and Lint Tests | ||
| - **Key Files**: | ||
| - `dev/bots/analyze.dart`: Enforces style and structure rules. | ||
| - `dev/bots/test.dart`: Main test orchestrator. | ||
| - **Documentation**: [Running-and-writing-tests.md](Running-and-writing-tests.md) | ||
| - **Run Locally**: Yes. | ||
| - **Commands**: | ||
| - Run analysis: `bin/cache/dart-sdk/bin/dart --enable-asserts dev/bots/analyze.dart` (Verified locally, takes > 60 seconds for full run). | ||
| - **Speed**: Slow (> 60 seconds) for full execution. | ||
|
|
||
| ### 6. Package Tests | ||
| - **Location**: `packages/*/test/` (excluding `flutter` and `flutter_tools`) | ||
| - **Language**: Dart | ||
| - **Description**: Tests for packages. Any folder with a `pubspec.yaml` file is considered a package and may contain a `test/` directory. | ||
| - **Documentation**: [Running-and-writing-tests.md](Running-and-writing-tests.md) | ||
| - **Run Locally**: Yes. | ||
| - **Commands**: | ||
| - Run tests in a package: `bin/flutter test packages/<package_name>/test` | ||
| - **Speed**: Fast (< 10 seconds) for individual tests. | ||
|
|
||
| ### 7. Engine Tests | ||
| - **Location**: `engine/src` (in the [flutter/engine](https://github.com/flutter/engine) repository) | ||
| - **Language**: C++, Dart, Java, Kotlin, etc. | ||
| - **Description**: Tests for the Flutter engine. | ||
| - **Documentation**: [Testing-the-engine.md](../../engine/testing/Testing-the-engine.md) | ||
| - **Run Locally**: Yes, but requires the complete Engine development environment (GN, Ninja, etc.). | ||
| - **Commands**: | ||
| - **Using `run_tests.py` from `engine/src/flutter`**: | ||
|
reidbaker marked this conversation as resolved.
|
||
| - Run C++ tests: `testing/run_tests.py --type=engine` | ||
| - Run Java tests: `testing/run_tests.py --type=java` | ||
| - Run Dart tests: `testing/run_tests.py --type=dart` | ||
|
reidbaker marked this conversation as resolved.
|
||
| - **Using `et` (Engine Tool)**: | ||
| - Run a test target: `et test //flutter/impeller:impeller_unittests` | ||
| - Query test targets: `et query targets --testonly` | ||
| - **Speed**: Fast for individual unit tests, Slow for full suites. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.