[wiki migration] Remaining pages under docs/contributing/ (#148790)
This commit is contained in:
77
docs/contributing/testing/Flutter-Test-Fonts.md
Normal file
77
docs/contributing/testing/Flutter-Test-Fonts.md
Normal file
@@ -0,0 +1,77 @@
|
||||
Flutter tests run via the `flutter test` command have access to several readily available test fonts, including [FlutterTest](#the-fluttertest-test-font) and [Ahem](https://www.w3.org/Style/CSS/Test/Fonts/Ahem/).
|
||||
|
||||
In tests, if [`fontFamily`](https://master-api.flutter.dev/flutter/painting/TextStyle/fontFamily.html) isn't specified or the specified font families are not available, the default test font `FlutterTest` will be used.
|
||||
If you wish to use a custom font in tests, check out the [`FontLoader`](https://master-api.flutter.dev/flutter/services/FontLoader-class.html) class, and [this example](https://github.com/flutter/flutter/blob/6ec444506375cfa94535a45c2320e01094c295e0/packages/flutter/test/material/icons_test.dart#L149-L172).
|
||||
|
||||
## The `FlutterTest` test font
|
||||
|
||||
### Font Metrics (in design units)
|
||||
|
||||
| | Ascent | Descent | Line Gap (Leading) | Units Per EM | Underline Position |
|
||||
| :-- | :---: | :---: | :---: | :---: | :---: |
|
||||
| `FlutterTest` | 768 (0.75 em) above the baseline | 256 (0.25 em) below the baseline | 0 | 1024 | 146 under the baseline |
|
||||
| `Ahem` | 800 (0.8 em) above the baseline | 200 (0.2 em) below the baseline | 0 | 1000 | 142 under the baseline |
|
||||
|
||||
The `FlutterTest` font's `1024 units-per-em` is a power of 2, making it less likely to introduce precision loss in metrics calculations, when used as a divisor.
|
||||
Thanks to that, the `FlutterTest` font generally provides more precise and font-engine-agnostic font/glyph metrics than `Ahem`.
|
||||
|
||||
**Example**
|
||||
|
||||
You can expect this test to pass on all platforms (currently with the exception of the web HTML renderer):
|
||||
```dart
|
||||
final painter = TextPainter(
|
||||
text: const TextSpan(
|
||||
text: 'text',
|
||||
style: TextStyle(fontSize: 14.0, /* "fontFamily: 'FlutterTest'" is implied */),
|
||||
),
|
||||
textDirection: TextDirection.ltr,
|
||||
textScaleFactor: 1.0,
|
||||
);
|
||||
final lineMetrics = textPainer.computeLineMetrics().first;
|
||||
|
||||
expect(lineMetrics.height, 14.0);
|
||||
expect(lineMetrics.ascent, 10.5); // 0.75em * 14.0pt
|
||||
expect(lineMetrics.descent, 3.5); // 0.25em * 14.0pt
|
||||
// 'text' is 4 glyphs. Most glyphs are as wide as they are tall.
|
||||
expect(lineMetrics.width, 14.0 * 4);
|
||||
```
|
||||
While with the `Ahem` font you would get [slightly different metrics on different platforms](https://github.com/flutter/flutter/issues/62819), since they use different font engines to scale the font.
|
||||
|
||||
### Glyphs
|
||||
|
||||
(images to be added)
|
||||
|
||||
The font covers most types of glyphs defined in the `Ahem` font.
|
||||
|
||||
| Square | Ascent Flushed | Descent Flushed | .notdef |
|
||||
| :---: | :----: | :----: | :----: |
|
||||
| a box that fills the em square | the **Square** glyph but without the part above the baseline | the **Square** glyph but without the part below the baseline | a hollow box |
|
||||
|
||||
The remaining glyphs (for example, **Full Advance**, **1/2 Advance**) are defined with no outlines in the glyph, with different x-advances.
|
||||
|
||||
|
||||
### Glyph Mapping
|
||||
|
||||
Unmapped codepoints will be mapped to the **.notdef** glyph in the test environment.
|
||||
|
||||
| \ Script <br />Glyph | DFLT | grek | hani | latn |
|
||||
| :--- | :----: | :----: | :----: | :----: |
|
||||
| Square | **codepoint(s):** 0x21-0x26, 0x28-0x40, 0x5b-0x60, 0x7b-0x7e, 0xa1-0xa9, 0xab-0xb9, 0xbb-0xbf, 0xd7, 0xf7, 0x2c6-0x2c7, 0x2c9, 0x2d8-0x2dd, 0x2013-0x2014, 0x2018-0x201a, 0x201c-0x201e, 0x2020-0x2022, 0x2026, 0x2030, 0x2039-0x203a, 0x2044, 0x2122, 0x2202, 0x2206, 0x220f, 0x2211-0x2212, 0x2219-0x221a, 0x221e, 0x222b, 0x2248, 0x2260, 0x2264-0x2265, 0x22f2, 0x25ca, 0xf000-0xf002<br />**character(s):** `!` `"` `#` `$` `%` `&` `(` `)` `*` `+` `,` `-` `.` `/` `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` `:` `;` `<` `=` `>` `?` `@` `[` `\` `]` `^` `_` `` ` `` `{` `\|` `}` `~` `¡` `¢` `£` `¤` `¥` `¦` `§` `¨` `©` `«` `¬` `<SOFT HYPHEN>` `®` `¯` `°` `±` `²` `³` `´` `µ` `¶` `·` `¸` `¹` `»` `¼` `½` `¾` `¿` `×` `÷` `ˆ` `ˇ` `ˉ` `˘` `˙` `˚` `˛` `˜` `˝` `–` `—` `‘` `’` `‚` `“` `”` `„` `†` `‡` `•` `…` `‰` `‹` `›` `⁄` `™` `∂` `∆` `∏` `∑` `−` `∙` `√` `∞` `∫` `≈` `≠` `≤` `≥` `⋲` `◊` `<0xf000>` `<0xf001>` `<0xf002>` | **codepoint(s):** 0x394, 0x3a5, 0x3a7, 0x3a9, 0x3bc, 0x3c0, 0x2126<br />**character(s):** `Δ` `Υ` `Χ` `Ω` `μ` `π` `Ω` | **codepoint(s):** 0x3007, 0x4e00, 0x4e03, 0x4e09, 0x4e2d, 0x4e5d, 0x4e8c, 0x4e94, 0x516b, 0x516d, 0x5341, 0x5426, 0x56d7, 0x56db, 0x571f, 0x6587, 0x6587, 0x662f, 0x6728, 0x672c, 0x6b63, 0x6c34, 0x6d4b, 0x706b, 0x786e, 0x8bd5, 0x91d1<br />**character(s):** `〇` `一` `七` `三` `中` `九` `二` `五` `八` `六` `十` `否` `囗` `四` `土` `文` `文` `是` `木` `本` `正` `水` `测` `火` `确` `试` `金` | **codepoint(s):** 0x41-0x5a, 0x61-0x7a, 0xaa, 0xba, 0xc0-0xc8, 0xca-0xd6, 0xd8-0xf6, 0xf8-0xff, 0x131, 0x152-0x153, 0x178, 0x192<br />**character(s):** `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` `ª` `º` `À` `Á` `Â` `Ã` `Ä` `Å` `Æ` `Ç` `È` `Ê` `Ë` `Ì` `Í` `Î` `Ï` `Ð` `Ñ` `Ò` `Ó` `Ô` `Õ` `Ö` `Ø` `Ù` `Ú` `Û` `Ü` `Ý` `Þ` `ß` `à` `á` `â` `ã` `ä` `å` `æ` `ç` `è` `é` `ê` `ë` `ì` `í` `î` `ï` `ð` `ñ` `ò` `ó` `ô` `õ` `ö` `ø` `ù` `ú` `û` `ü` `ý` `þ` `ÿ` `ı` `Œ` `œ` `Ÿ` `ƒ` |
|
||||
| Ascent Flushed | | | | **codepoint(s):** 0x70<br />**character(s):** `p` |
|
||||
| Descent Flushed | | | | **codepoint(s):** 0xc9<br />**character(s):** `É` |
|
||||
| Full Advance | **codepoint(s):** 0x20<br />**character(s):** `<SPACE>` | | | |
|
||||
| 1/2 Advance | **codepoint(s):** 0x2002<br />**character(s):** `<EN SPACE>` | | | |
|
||||
| 1/3 Advance | **codepoint(s):** 0x2004<br />**character(s):** `<THREE-PER-EM SPACE>` | | | |
|
||||
| 1/4 Advance | **codepoint(s):** 0x2005<br />**character(s):** `<FOUR-PER-EM SPACE>` | | | |
|
||||
| 1/6 Advance | **codepoint(s):** 0x2006<br />**character(s):** `<SIX-PER-EM SPACE>` | | | |
|
||||
| 1/5 Advance | **codepoint(s):** 0x2009<br />**character(s):** `<THIN SPACE>` | | | |
|
||||
| 1/10 Advance | **codepoint(s):** 0x200a<br />**character(s):** `<HAIR SPACE>` | | | |
|
||||
| Zero Advance | **codepoint(s):** 0xfeff<br />**character(s):** `<ZERO WIDTH NO-BREAK SPACE>` | | | |
|
||||
|
||||
### Caveats
|
||||
|
||||
To disable FreeType auto-hinter, the family name defined within the font is not `FlutterTest` but `MingLiU`. This typically doesn't affect framework tests as the font is registered under the name `FlutterTest`.
|
||||
|
||||
### Adding more Codepoints/Glyphs to the `FlutterTest` Font
|
||||
|
||||
The `FlutterTest` font is generated by [this script](https://github.com/flutter/engine/blob/170cbea/tools/gen_test_font.py).
|
||||
@@ -0,0 +1,121 @@
|
||||
There are many ways to write a memory test for Flutter. In this article, we give 3 classes of example tests that are currently used by Flutter device lab. Memory performance is a high priority for Flutter so there are many new memory tools and test utilities in progress. We’ll add them in this doc in the future.
|
||||
|
||||
## [MemoryTest][class MemoryTest] that interacts with adb directly
|
||||
|
||||
These memory tests use the [MemoryTest class defined in the device lab perf_tests.dart][class MemoryTest] to poll adb directly before and after an overridable `useMemory` function. By default, `useMemory` will just run an app in release and wait for a “done” message to be printed in logcat.
|
||||
|
||||
Examples include
|
||||
- [`complex_layout_scroll_perf__memory`][complex layout memory manifest]
|
||||
- [device lab task file][complex layout memory task]
|
||||
- [main file][complex layout memory main]
|
||||
- [`fast_scroll_large_images_memory`][fast scroll memory manifest]
|
||||
- [device lab task file][fast scroll memory task]
|
||||
- [main file][fast scroll memory main]
|
||||
|
||||
To write a new MemoryTest case `some_memory_perf` and add it to Flutter’s device lab so Flutter’s CI system can measure it for each Flutter commit, follow examples above to
|
||||
|
||||
1. Create a `main` function for the test app in a file named like `test_memory/some_memory_perf.dart`.
|
||||
2. Add a `some_memory_perf` entry to [manifest.yaml][manifest]
|
||||
3. Add a `some_memory_perf.dart` file to [dev/devicelab/bin/tasks][tasks] folder.
|
||||
|
||||
|
||||
### Pros
|
||||
- Low overhead.
|
||||
- Works in all runtime modes, including release.
|
||||
- The test has complete control on when to start and stop the memory measurement.
|
||||
|
||||
### Cons
|
||||
- Only have 2 memory readings, begin and end, during the app run.
|
||||
- Polling ADB may trigger collections of the Java heap.
|
||||
- Only works on Android targets.
|
||||
- Requires a test environment with access to ADB.
|
||||
- Requires a host machine with Flutter SDK installed.
|
||||
|
||||
## DevTools Memory Test
|
||||
|
||||
The memory tests use DevTools to poll adb and Dart VM during a normal Flutter driver test run, which typically measures speed performance instead of memory performance. [DevToolsMemoryTest][class DevToolsMemoryTest] handles most of the process so a new test only needs to specify the driver test location.
|
||||
|
||||
Examples include
|
||||
- [`complex_layout_scroll_perf__devtools_memory`][complex layout devtools memory manifest]
|
||||
- [device lab task file][complex layout devtools memory task]
|
||||
- [`large_image_changer_perf_android`][large image changer manifest]
|
||||
- [device lab task file][large image changer task]
|
||||
|
||||
To write a new DevTools memory test case `some_memory_perf` and add it to Flutter’s device lab so Flutter’s CI system can measure it for each Flutter commit, follow examples above to
|
||||
|
||||
1. Write (or reuse) a normal Flutter driver test for the app in files named like `test_driver/some_memory_perf.dart` and `test_driver/some_memory_perf_test.dart`.
|
||||
2. Add a `some_memory_perf` entry to [manifest.yaml][manifest]
|
||||
3. Add a `some_memory_perf.dart` file to [dev/devicelab/bin/tasks][tasks] folder.
|
||||
|
||||
### Pros
|
||||
- Have finer grained measurements (~1 reading per second).
|
||||
- Also have Dart VM memory info.
|
||||
- Can easily turn a speed-focused driver test into a memory test.
|
||||
|
||||
### Cons
|
||||
- Don’t have much control on when to start and stop the measurement.
|
||||
- Polling ADB may trigger collections on the Java heap.
|
||||
- Requires a test environment with access to ADB.
|
||||
- Only works on Android targets.
|
||||
- Not available for release mode, so may incur extra memory overhead in profile or debug mode.
|
||||
- Requires a host machine with Flutter SDK installed.
|
||||
|
||||
## iOS Memory Test
|
||||
|
||||
The iOS embedding of Flutter supports sampling memory usage during runtime, which then writes metrics to the [Dart timeline][Dart timeline]. After recording a timeline for the relevant portion of an application’s execution, the timeline can be analyzed to obtain memory related information from the profile.
|
||||
|
||||
Examples include
|
||||
- [`large_image_changer_perf_ios`][large image changer manifest ios]
|
||||
- [device lab task file][large image changer task ios]
|
||||
|
||||
To write a new iOS memory test case `some_memory_perf` and add it to Flutter’s device lab so Flutter’s CI system can measure it for each Flutter commit, follow examples above to
|
||||
|
||||
1. Write (or reuse) a normal Flutter driver test for the app in files named like `test_driver/some_memory_perf.dart` and `test_driver/some_memory_perf_test.dart`.
|
||||
2. Add a `some_memory_perf` entry to [manifest.yaml][manifest]
|
||||
3. Add a `some_memory_perf.dart` file to [dev/devicelab/bin/tasks][tasks] folder that specifies `measureMemory: true`.
|
||||
|
||||
### Pros
|
||||
- Can be run on a machine that does not have the Flutter SDK installed.
|
||||
- Can adjust the sampling frequency so one can have as many or as few measurements as needed.
|
||||
- Each sampling has much less overhead compared to calling adb
|
||||
- Flutter driver tests on iOS get memory measurements for free.
|
||||
|
||||
### Cons
|
||||
- Only works on iOS targets.
|
||||
- Not available for release mode, so may incur extra memory overhead in profile or debug mode.
|
||||
- Memory polling mechanism may incur additional memory overhead.
|
||||
|
||||
|
||||
[manifest]: https://github.com/flutter/flutter/blob/main/dev/devicelab/manifest.yaml
|
||||
|
||||
[tasks]: https://github.com/flutter/flutter/tree/main/dev/devicelab/bin/tasks
|
||||
|
||||
[class MemoryTest]: https://github.com/flutter/flutter/blob/51bb11f7cece47840a9ee6d6d43db97ab16b31df/dev/devicelab/lib/tasks/perf_tests.dart#L941
|
||||
|
||||
[complex layout memory manifest]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/manifest.yaml#L329
|
||||
|
||||
[complex layout memory task]: https://github.com/flutter/flutter/blob/main/dev/devicelab/bin/tasks/complex_layout_scroll_perf__memory.dart
|
||||
|
||||
[complex layout memory main]: https://github.com/flutter/flutter/blob/main/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart
|
||||
|
||||
[fast scroll memory manifest]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/manifest.yaml#L837
|
||||
|
||||
[fast scroll memory task]: https://github.com/flutter/flutter/blob/main/dev/devicelab/bin/tasks/fast_scroll_large_images__memory.dart
|
||||
|
||||
[fast scroll memory main]: https://github.com/flutter/flutter/blob/main/dev/benchmarks/macrobenchmarks/test_memory/large_images.dart
|
||||
|
||||
[class DevToolsMemoryTest]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/lib/tasks/perf_tests.dart#L1138
|
||||
|
||||
[complex layout devtools memory manifest]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/manifest.yaml#L359
|
||||
|
||||
[complex layout devtools memory task]: https://github.com/flutter/flutter/blob/main/dev/devicelab/bin/tasks/complex_layout_scroll_perf__devtools_memory.dart
|
||||
|
||||
[large image changer manifest]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/manifest.yaml#L874
|
||||
|
||||
[large image changer task]: https://github.com/flutter/flutter/blob/main/dev/devicelab/bin/tasks/large_image_changer_perf_android.dart
|
||||
|
||||
[Dart timeline]:https://flutter.dev/docs/development/tools/devtools/timeline
|
||||
|
||||
[large image changer manifest ios]: https://github.com/flutter/flutter/blob/7e41425d4af21dec7a7ff072a3ec1387859e32c8/dev/devicelab/manifest.yaml#L880
|
||||
|
||||
[large image changer task ios]: https://github.com/flutter/flutter/blob/main/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart
|
||||
@@ -0,0 +1,258 @@
|
||||
There are many ways to write a render speed test for Flutter. In this article, we give one example that uses [e2e][] (or [Flutter driver][flutter_driver]), the [dev/benchmarks/macrobenchmarks][macrobenchmarks] app, and the [dev/devicelab][devicelab] to automatically collect metrics for every future Flutter commit and send them to [flutter/cocoon][cocoon].
|
||||
|
||||
The instructions below are for contributors who want to expose a Flutter SDK (framework or engine) performance issue, or write pull requests to fix such issues. If one only needs to test the performance of a particular Flutter app, please reference
|
||||
- https://flutter.dev/docs/cookbook/testing/integration/introduction.
|
||||
- [https://flutter.dev/docs/perf/rendering](https://flutter.dev/docs/perf/rendering)
|
||||
|
||||
Since Flutter Web and Flutter Desktop are still in their early stages, the content here is only well tested and supported on mobile platforms (Android/iOS). We'll come up with docs on how to write performance tests for Web/Desktop later.
|
||||
|
||||
Throughout this doc, we assume that the render speed test is for some `super_important_case`.
|
||||
|
||||
## 1. Add a page to macrobenchmarks
|
||||
|
||||
The [macrobenchmarks][] is a Flutter app that includes many pages each of which corresponds to a specific performance test scenario. It provides some boilerplate code and auto-generated files so when a new scenario needs to be tested, one only needs to add a single page and a handful of files to the [Flutter repo][flutter_repo] instead of adding a new Flutter app with dozens of auto-generated files. (The "macro" means that it's benchmarking a big system, including the whole Flutter framework and engine, instead of just a micro Dart or C++ function.)
|
||||
|
||||
To add a new test scenario `super_important_case`, do the following:
|
||||
|
||||
1. Create a `super_important_case.dart` inside [macrobenchmarks/lib/src][] to define a `SuperImportantCasePage extends StatelessWidget {...}`. If there's a minimal Flutter app with a single `main.dart` file that reproduces the performance issue in the `super_important_case`, we'd often copy the content of that `main.dart` to `super_important_case.dart`.
|
||||
2. Add a `const String kSuperImportantCaseRouteName = '/super_important_case'` to [macrobenchmarks/lib/common.dart][] for later use.
|
||||
3. Open [macrobenchmarks/lib/main.dart][] and add the `kSuperImportantCaseRouteName: (BuildContext conttext) => SuperImportantCasePage(),` to the routes of [`MacrobenchmarksApp`][].
|
||||
4. Scroll down to [`HomePage`'s `ListView`][] and add the following `RaisedButton` so manual testers and the Flutter driver can tap it to navigate to the `super_important_case`.
|
||||
|
||||
```Dart
|
||||
RaisedButton(
|
||||
key: const Key(kSuperImportantCaseRouteName),
|
||||
child: const Text('Super Important Case'),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, kSuperImportantCaseRouteName);
|
||||
},
|
||||
),
|
||||
```
|
||||
|
||||
## 2. Add an e2e test
|
||||
|
||||
When the `super_important_case` page above is finished and manually tested, one can then add an automated integration test to get some performance metrics as follows.
|
||||
|
||||
1. We use [macrobenchmarks/test_driver/e2e_test.dart][] as the host side script. All other tests depends on this file, so discuss with other Flutter members first if you want to change it.
|
||||
|
||||
2. Add `super_important_case_e2e.dart` to [macrobenchmarks/test][] with the following content. The `macroPerfTestE2E` function will navigate the macrobenchmarks app to the `super_important_case` page, and starts collecting performance metrics. The optional arguments are:
|
||||
- The `pageDelay` is the time delay for loading the page. By default it doesn't wait.
|
||||
- The `duration` is the performance metric sampling time.
|
||||
- The `timeout` specifies the backstop timeout implemented by the test package, See [testWidgets](https://api.flutter.dev/flutter/flutter_test/testWidgets.html).
|
||||
- The `body` provides custom ways of driving that page during the benchmark such as scrolling through lists. When this is used together with `duration`, the test will perform for which ever last longer.
|
||||
- The `setup` provides the operation needed to setup before benchmark starts.
|
||||
|
||||
|
||||
```Dart
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:macrobenchmarks/common.dart';
|
||||
|
||||
import 'util.dart';
|
||||
|
||||
void main() {
|
||||
macroPerfTestE2E(
|
||||
'super_important_case',
|
||||
kSuperImportantCaseRouteName,
|
||||
/* optional */ pageDelay: const Duration(seconds: 1),
|
||||
/* optional */ duration: const Duration(seconds: 3),
|
||||
/* optional */ timeout: const Duration(seconds: 30),
|
||||
/* optional */ body: (WidgetController controller) async {
|
||||
...
|
||||
},
|
||||
/* optional */ setup: (WidgetController controller) async {
|
||||
...
|
||||
},
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Once all steps above are done, one should be able to run `flutter drive -t test/super_important_case_perf.dart --driver test_driver/e2e_test.dart` inside the [macrobenchmarks][] directory. After the driver test finished, the metrics should be written into a json file named `e2e_perf_summary.json` inside a temporary `build` directory under the current [macrobenchmarks][] directory.
|
||||
|
||||
|
||||
<!--- TODO explain what these metrics mean in the future -->
|
||||
Some useful metrics in that json file include
|
||||
- `average_frame_build_time_millis`
|
||||
- `average_frame_rasterization_time_millis`
|
||||
- `worst_frame_build_time_millis`
|
||||
- `worst_frame_rasterization_time_millis`
|
||||
|
||||
## 2a. Add a driver test (deprecated)
|
||||
|
||||
(Skip this if step 2 is sufficient for you.)
|
||||
|
||||
When the `super_important_case` page above is finished and manually tested, one can then add an automatic driver test to get some performance metrics as follows.
|
||||
|
||||
1. We use [macrobenchmarks/test_driver/run_app.dart] as the device side app. All other tests depends on this file, so discuss with other Flutter members first if you want to change it.
|
||||
|
||||
2. Add `super_important_case_perf_test.dart` to [macrobenchmarks/test_driver][] with the following content. The `macroPerfTest` function will navigate the macrobenchmarks app to the `super_important_case` page, and starts collecting performance metrics. The `driverOps` provides custom ways of driving that page during the benchmark such as scrolling through lists. The `setupOps` provides the operation needed to setup before benchmark starts.
|
||||
|
||||
```Dart
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:macrobenchmarks/common.dart';
|
||||
|
||||
import 'util.dart';
|
||||
|
||||
void main() {
|
||||
macroPerfTest(
|
||||
'super_important_case',
|
||||
kSuperImportantCaseRouteName,
|
||||
pageDelay: const Duration(seconds: 1),
|
||||
/* optional */ driverOps: (FlutterDriver driver) async {
|
||||
...
|
||||
},
|
||||
/* optional */ setupOps: (FlutterDriver driver) async {
|
||||
...
|
||||
},
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Once all steps above are done, one should be able to run `flutter drive -t test_driver/run_app.dart --driver test_driver/super_important_case_perf.dart` inside the [macrobenchmarks][] directory. After the driver test finished, the metrics should be written into a json file named `super_important_case_perf__timeline_summary.json` inside a temporary `build` directory under the current [macrobenchmarks][] directory.
|
||||
|
||||
|
||||
<!--- TODO explain what these metrics mean in the future -->
|
||||
Some useful metrics in that json file include
|
||||
- `average_frame_build_time_millis`
|
||||
- `average_frame_rasterization_time_millis`
|
||||
- `worst_frame_build_time_millis`
|
||||
- `worst_frame_rasterization_time_millis`
|
||||
|
||||
## 3. Update README
|
||||
|
||||
Add the new test to the list in [macrobenchmarks/README.md].
|
||||
|
||||
## 4. Add a task to devicelab
|
||||
|
||||
To keep Flutter performant, running a test locally once in a while and check the metrics manually is insufficient. The following steps let the [devicelab][] run the test automatically for every Flutter commit so performance regressions or speedups for the `super_important_case` can be detected quickly.
|
||||
|
||||
1. Add `super_important_case_perf__e2e_summary` to [dev/devicelab/manifest.yaml][] under `tasks`. Follow other tasks to properly set descriptions and choose agent such as `linux/android` (Moto G4) or `mac/ios` (iPhone 6s). Mark it `flaky: true` so that while we observe the test case behavior on devicelab, we don't block the build tree.
|
||||
|
||||
2. Add `super_important_case_perf__e2e_summary.dart` to [dev/devicelab/bin/tasks][] with a content like
|
||||
|
||||
```Dart
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/adb.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.android; // or ios
|
||||
await task(createSuperImportantCasePerfE2ETest());
|
||||
}
|
||||
```
|
||||
|
||||
3. Add the following `createSuperImportantCasePerfTest` function to [dev/devicelab/lib/tasks/perf_tests.dart][]
|
||||
|
||||
```Dart
|
||||
TaskFunction createSuperImportantCasePerfE2ETest() {
|
||||
return PerfTest.e2e(
|
||||
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
|
||||
'test/super_important_case_e2e.dart',
|
||||
).run;
|
||||
}
|
||||
```
|
||||
|
||||
4. Locally test the devicelab task by running `../../bin/cache/dart-sdk/bin/dart bin/run.dart -t super_important_case_perf__e2e_summary` inside the [dev/devicelab][devicelab] directory with an Android or iOS device connected. You should see a success and a summary of metrics being printed out.
|
||||
|
||||
5. Submit a pull request of everything above.
|
||||
|
||||
6. Finally, remove `flaky: true` once the test is proven to be reliable for a few days. Since this may take a while, creating a reminder calendar event could be a good idea.
|
||||
|
||||
## 4a. Add a task to devicelab for driver tests (deprecated)
|
||||
|
||||
(Skip this if you didn't do step 2a.)
|
||||
|
||||
To keep Flutter performant, running a test locally once in a while and check the metrics manually is insufficient. The following steps let the [devicelab][] run the test automatically for every Flutter commit so performance regressions or speedups for the `super_important_case` can be detected quickly.
|
||||
|
||||
1. Add `super_important_case_perf__timeline_summary` to [dev/devicelab/manifest.yaml][] under `tasks`. Follow other tasks to properly set descriptions and choose agent such as `linux/android` (Moto G4) or `mac/ios` (iPhone 6s).
|
||||
|
||||
2. Add `super_important_case_perf__timeline_summary.dart` to [dev/devicelab/bin/tasks][] with a content like
|
||||
|
||||
```Dart
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/adb.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.android; // or ios
|
||||
await task(createSuperImportantCasePerfTest());
|
||||
}
|
||||
```
|
||||
|
||||
3. Add the following `createSuperImportantCasePerfTest` function to [dev/devicelab/lib/tasks/perf_tests.dart][]
|
||||
|
||||
```Dart
|
||||
TaskFunction createSuperImportantCasePerfTest() {
|
||||
return PerfTest(
|
||||
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
|
||||
'test_driver/run_app.dart',
|
||||
'super_important_case_perf',
|
||||
testDriver: 'test_driver/super_important_case_perf_test.dart',
|
||||
).run;
|
||||
}
|
||||
```
|
||||
|
||||
4. Locally test the devicelab task by running `../../bin/cache/dart-sdk/bin/dart bin/run.dart -t super_important_case_perf__timeline_summary` inside the [dev/devicelab][devicelab] directory with an Android or iOS device connected. You should see a success and a summary of metrics being printed out.
|
||||
|
||||
5. Submit a pull request of everything above.
|
||||
|
||||
6. Finally, remove `flaky: true` once the test is proven to be reliable for a few days. Since this may take a while, creating a reminder calendar event could be a good idea.
|
||||
|
||||
## 5. Set benchmark baseline
|
||||
|
||||
Tasks will be run automatically in the [devicelab], and the result is shown in [flutter-dashboard]. Set the baseline in [flutter-dashboard] once the new test gets enough data. Also for metrics like "vsync_transitions_missed", change the unit from default ms to frames or other suitable units.
|
||||
|
||||
## Acknowledgement
|
||||
|
||||
Big congratulations if you've successfully finished all steps above! You just made a big contribution to Flutter's performance. Please also feel encouraged to improve this doc to help future contributors (which probably include a future yourself that would forget something above in a few months)!
|
||||
|
||||
<!-- Reference links below -->
|
||||
[flutter_driver]: https://github.com/flutter/flutter/tree/main/packages/flutter_driver
|
||||
|
||||
[macrobenchmarks]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks
|
||||
|
||||
[cocoon]: https://github.com/flutter/cocoon
|
||||
|
||||
[devicelab]: https://github.com/flutter/flutter/tree/main/dev/devicelab
|
||||
|
||||
[dev/devicelab/manifest.yaml]: https://github.com/flutter/flutter/tree/main/dev/devicelab/manifest.yaml
|
||||
|
||||
[flutter_repo]: https://github.com/flutter/flutter
|
||||
|
||||
[macrobenchmarks/lib/src]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks/lib/src
|
||||
|
||||
[macrobenchmarks/lib/common.dart]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks/lib/common.dart
|
||||
|
||||
[macrobenchmarks/lib/main.dart]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks/lib/main.dart
|
||||
|
||||
[`MacrobenchmarksApp`]: https://github.com/flutter/flutter/blob/94b7ff241e6e5445b7f30215a777eb4971311797/dev/benchmarks/macrobenchmarks/lib/main.dart#L24
|
||||
|
||||
[`HomePage`'s `ListView`]: https://github.com/flutter/flutter/blob/94b7ff241e6e5445b7f30215a777eb4971311797/dev/benchmarks/macrobenchmarks/lib/main.dart#L58
|
||||
|
||||
[macrobenchmarks/test_driver]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks/test_driver
|
||||
|
||||
[macrobenchmarks/test_driver/run_app.dart]: https://github.com/flutter/flutter/tree/main/dev/benchmarks/macrobenchmarks/test_driver/run_app.dart
|
||||
|
||||
[macrobenchmarks/README.md]: https://github.com/flutter/flutter/blob/main/dev/benchmarks/macrobenchmarks/README.md
|
||||
|
||||
[dev/devicelab/bin/tasks]: https://github.com/flutter/flutter/tree/main/dev/devicelab/bin/tasks
|
||||
|
||||
[dev/devicelab/lib/tasks/perf_tests.dart]: https://github.com/flutter/flutter/tree/main/dev/devicelab/lib/tasks/perf_tests.dart
|
||||
|
||||
[flutter-dashboard]: https://flutter-dashboard.appspot.com/benchmarks.html
|
||||
|
||||
[e2e]: https://pub.dev/packages/e2e
|
||||
|
||||
[macrobenchmarks/test_driver/e2e_test.dart]: https://github.com/flutter/flutter/blob/main/dev/benchmarks/macrobenchmarks/test_driver/e2e_test.dart
|
||||
|
||||
[macrobenchmarks/test]: https://github.com/flutter/flutter/blob/main/dev/benchmarks/macrobenchmarks/test
|
||||
@@ -0,0 +1,108 @@
|
||||
In the last months Flutter Driver tests has been enabled for most browsers.
|
||||
|
||||
This document explains the steps that should be followed before running the tests, how to run the tests, example usages and handy tools that can be used.
|
||||
|
||||
## Preparing the driver
|
||||
|
||||
The first step of using Flutter Driver tests for Flutter Web testing is to install(prepare) the driver for the target browser.
|
||||
|
||||
### Using Chrome
|
||||
|
||||
For Chrome Desktop browsers:
|
||||
|
||||
- Check the version of Chrome.
|
||||
- Download the Chrome driver for that version from [driver downloads](https://chromedriver.chromium.org/downloads).
|
||||
- Start the driver on port 4444. `chromedriver --port=4444`
|
||||
|
||||
Chrome on Android browser tests can be run both on device and on the emulator.
|
||||
|
||||
- Both for using a real device and emulator, make sure that Android platform tools are installed
|
||||
- For using an emulator, follow the [instructions](https://developer.android.com/studio/run/managing-avds) for creating and managing one.
|
||||
- For real device tests check the devices Chrome's version. Please note that the Chrome installed on the emulator will probably have a different version than the host machine. Check the emulator's Chrome's version.
|
||||
- Download the driver [driver downloads](https://chromedriver.chromium.org/downloads).
|
||||
- Start the adb server: `adb start-server` you can later kill with `adb kill-server`
|
||||
- For the web port you are planning to use for Flutter driver tests, let's say 8080 for example:
|
||||
- Test the browser has access to a server running on localhost:8080
|
||||
- One can utilize adb for this purpose. For more [details](https://developer.android.com/studio/command-line/adb).
|
||||
- Another alternative is using Chrome Remote devices from browser page `chrome://inspect/devices#devices`. For more details on useful links: [remote debugging webviews](https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews), [remote debugging android devices](https://developers.google.com/web/tools/chrome-devtools/remote-debugging)
|
||||
- Start the Chrome driver on port 4444. `chromedriver --port=4444`
|
||||
|
||||
### Using Safari
|
||||
|
||||
Like Safari browser Safari driver also comes installed on the macOS devices. For using Safari on macOS steps are easy:
|
||||
|
||||
- Use the [instructions](https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari) to enable safari driver.
|
||||
- start safari driver on port 4444 `./usr/bin/safaridriver --port=4444`
|
||||
|
||||
IOS Safari can be run on a simulator. Simulators are part of Xcode, more [details](https://developer.apple.com/documentation/xcode). After making sure your macOS have simulators, follow the steps above to start the Safari driver. Unlike Android the Desktop Safari version and simulator version is the same.
|
||||
|
||||
### Using Firefox
|
||||
|
||||
- Check the version of Firefox.
|
||||
- Download the Gecko driver for that version from [the releases](https://github.com/mozilla/geckodriver/releases).
|
||||
- Add the Firefox driver to your path.
|
||||
|
||||
Note that this section is experimental, at this point we don't have automated tests running on Firefox.
|
||||
|
||||
### Using Edge
|
||||
|
||||
More information can be found on Edge Drivers on [developer site](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/). Edge driver should also be added to the path after installation.
|
||||
|
||||
Note that this section is experimental, at this point we don't have automated tests running on Edge.
|
||||
|
||||
## Running Flutter Driver tests
|
||||
|
||||
The command for running the driver tests:
|
||||
|
||||
```
|
||||
flutter drive --target=test_driver/[driver_test].dart -d web-server --release --browser-name=chrome --web-port=8080
|
||||
```
|
||||
|
||||
Let's go over the different arguments that can be used:
|
||||
|
||||
- Use one of the six browsers for `--browser-name` parameter: chrome, safari, ios-safari, android-chrome, firefox, edge.
|
||||
- Use `--local-engine=host_debug_unopt --local-engine-host=host_debug_unopt` for running tests with a local engine.
|
||||
- Use `--release` or `--profile` mode for running the tests. Debug mode will be supported soon.
|
||||
- Change the `--webport` as needed, don't forget to change remote debugging settings for Android Chrome.
|
||||
- Use `--no-android-emulator` for using Android with real devices.
|
||||
|
||||
## Web Installers Repo
|
||||
|
||||
Web installers is a new Flutter project [repository](https://github.com/flutter/web_installers) where we are planning to add utilities for launching, downloading browsers/drivers.
|
||||
|
||||
Currently it can be used for downloading/running Chrome Driver:
|
||||
|
||||
```
|
||||
dart lib/web_driver_installer.dart chromedriver --driver-version="78.0.3904.105"
|
||||
```
|
||||
|
||||
Or for running the Safari driver:
|
||||
|
||||
```
|
||||
dart lib/web_driver_installer.dart safaridriver
|
||||
```
|
||||
|
||||
For more details use the [documentation](https://github.com/flutter/web_installers/tree/master/packages/web_drivers).
|
||||
|
||||
## Examples From Flutter Project
|
||||
|
||||
We already use Flutter Driver in many different places in Flutter Project. We have a smoke test running as a [Cirrus CI task](https://github.com/flutter/flutter/blob/main/.cirrus.yml#L291) in Flutter repo, which is also a great example for showing web_installers + flutter drive usage.
|
||||
|
||||
```
|
||||
script:
|
||||
- flutter config --enable-web
|
||||
- git clone https://github.com/flutter/web_installers.git
|
||||
- cd web_installers/packages/web_drivers/
|
||||
- pub get
|
||||
- dart lib/web_driver_installer.dart &
|
||||
- sleep 20
|
||||
- chromedriver/chromedriver --port=4444 &
|
||||
- sleep 5
|
||||
- cd ../../../examples/hello_world/
|
||||
- flutter drive --target=test_driver/smoke_web_engine.dart -d web-server --profile --browser-name=chrome
|
||||
```
|
||||
|
||||
Other example usages:
|
||||
|
||||
- e2e tests under flutter/packages repo. ([PR](https://github.com/flutter/plugins/pull/2554))
|
||||
- web engine integration tests under engine repo. ([PR](https://github.com/flutter/engine/pull/16930))
|
||||
125
docs/contributing/testing/Running-and-writing-tests.md
Normal file
125
docs/contributing/testing/Running-and-writing-tests.md
Normal file
@@ -0,0 +1,125 @@
|
||||
## For the framework
|
||||
|
||||
Dart tests are written using the `flutter_test` package's API,
|
||||
named with the suffix `_test.dart`, and placed inside the
|
||||
`test/` subdirectory of the package under test.
|
||||
|
||||
We support several kinds of tests:
|
||||
|
||||
- Unit tests, e.g. using [`flutter_test`](https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html). See below.
|
||||
|
||||
- Unit tests that use golden-file testing, comparing pixels.
|
||||
See [Writing a golden-file test for package:flutter](Writing-a-golden-file-test-for-package-flutter.md).
|
||||
|
||||
- End-to-end tests, e.g. using [`flutter_driver`](https://api.flutter.dev/flutter/flutter_driver/flutter_driver-library.html) and our [device lab](https://github.com/flutter/flutter/blob/main/dev/devicelab/README.md).
|
||||
|
||||
Our bots run on our [test and build infrastructure](https://github.com/flutter/flutter/blob/main/dev/bots/README.md).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Flutter tests use the `flutter_test` package ([source](https://github.com/flutter/flutter/tree/main/packages/flutter_test), [API documentation](https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html)),
|
||||
which provides flutter-specific extensions on top of the [Dart `test` package](https://pub.dartlang.org/packages/test).
|
||||
|
||||
To automatically find all files named `*_test.dart` inside a package's `test/` subdirectory, and
|
||||
run them inside the headless flutter shell as a test, use the `flutter test` command, e.g:
|
||||
|
||||
- `cd examples/hello_world`
|
||||
- `flutter test`
|
||||
|
||||
Individual tests can also be run directly, e.g.: `flutter test lib/my_app_test.dart`
|
||||
|
||||
You can view these tests on a device by running them directly using `flutter run`.
|
||||
For tests inside the `packages/flutter` directory, you will need to copy them to
|
||||
(or symlink to them from) the `test/` directory of an actual app (e.g. the flutter
|
||||
gallery), since the `flutter` package itself is not set up to execute as an
|
||||
application (which is necessary to use `flutter run` with a test).
|
||||
|
||||
Unit tests run with `flutter test` run inside a headless flutter shell on your workstation,
|
||||
you won't see any UI. You can use `print` to generate console output or you can interact
|
||||
with the Dart VM via the Dart Observatory at [http://localhost:8181/](http://localhost:8181/).
|
||||
|
||||
To debug tests in Observatory, use the `--start-paused` option to start the test in a
|
||||
paused state and wait for connection from a debugger. This option lets you set breakpoints
|
||||
before the test runs.
|
||||
|
||||
To run analysis and all the tests for the entire Flutter repository, the same way that Cirrus
|
||||
runs them, run `dart dev/bots/test.dart` and `dart --enable-asserts dev/bots/analyze.dart`.
|
||||
|
||||
If you've built your own flutter engine (see [Setting up the Engine development environment](../../engine/dev/Setting-up-the-Engine-development-environment.md)), you
|
||||
can pass `--local-engine` to change what flutter shell `flutter test` uses. For example,
|
||||
if you built an engine in the `out/host_debug_unopt` directory, you can use:
|
||||
|
||||
```
|
||||
flutter test \
|
||||
--local-engine=host_debug_unopt \
|
||||
--local-engine-host=host_debug_unopt
|
||||
```
|
||||
|
||||
to run the tests in the locally built engine. Note that in this case you need to specify `host_debug_unopt`
|
||||
as both arguments.
|
||||
|
||||
To learn how to see how well tested the codebase is, see [Test coverage for package:flutter](Test-coverage-for-package-flutter.md).
|
||||
|
||||
_See also: [Flutter Test Fonts](Flutter-Test-Fonts.md)_
|
||||
|
||||
## Running device lab tests locally
|
||||
|
||||
Flutter runs a number of end-to-end tests in a device lab. The Flutter repo contains code for bootstrapping and executing these tests, in addition to the tests themselves.
|
||||
|
||||
The code that runs the device lab end-to-end tests can be found here:
|
||||
|
||||
```
|
||||
dev/devicelab
|
||||
```
|
||||
|
||||
The tests that run in the device lab can be found here:
|
||||
|
||||
```
|
||||
dev/integration_tests
|
||||
```
|
||||
|
||||
When a device lab test fails, it is important to be able to run the test locally to verify the problem and intended solution. To execute a device lab test locally, do the following:
|
||||
|
||||
1. Navigate in your terminal to the `dev/devicelab` directory.
|
||||
1. Ensure that a physical device, simulator, or emulator is connected.
|
||||
1. Ensure that the current locale is en_US by executing the command: `export LANG=en_US.UTF-8`.
|
||||
1. Execute the command: `../../bin/dart bin/run.dart -t [task_name]` where `[task_name]` is replaced by the name of the task you want to run as defined within `.ci.yaml`.
|
||||
|
||||
### Device lab tests with a local engine
|
||||
|
||||
Sometimes a device lab test fails due to engine changes that you've made. In these cases, you'd like to run the impacted device lab tests locally with your local version of the engine. To do this, pass the appropriate flags to `run.dart`:
|
||||
|
||||
```shell
|
||||
../../bin/dart bin/run.dart \
|
||||
--local-engine-src-path=[path_to_src] \
|
||||
--local-engine=[engine_build_for_your_device] \
|
||||
--local-engine-host=[host_engine_build_for_your_device] \
|
||||
-t [task_name]
|
||||
```
|
||||
|
||||
If your local Flutter engine is in the same directory as your `flutter/` directory then you can omit the `--local-engine-src-path` parameter because it will be resolved automatically:
|
||||
|
||||
```
|
||||
../../bin/dart bin/run.dart \
|
||||
--local-engine=[engine_build_for_your_device] \
|
||||
--local-engine-host=[host_engine_build_for_your_device] \
|
||||
-t [task_name]
|
||||
```
|
||||
|
||||
The following is an example of what running the local engine command might look like:
|
||||
|
||||
```
|
||||
../../bin/dart bin/run.dart \
|
||||
--local-engine-src-path=/Users/myname/flutter/engine/src \
|
||||
--local-engine=android_debug_unopt_x86 \
|
||||
--local-engine-host=host_debug_unopt_x86 \
|
||||
-t external_ui_integration_test
|
||||
```
|
||||
|
||||
The above command would use the local Flutter engine located at `/Users/myname/flutter/engine` to execute the `external_ui_integration_test` test on an Android emulator, which is why the `android_debug_unopt_x86` version of the engine is used.
|
||||
|
||||
Note that some tests may require `profile` mode instead of `debug` mode when running with local engine. Make sure to pass in the correct local engine. See [Compiling the engine](../../engine/dev/Compiling-the-engine.md) for more details.
|
||||
|
||||
## For the engine
|
||||
|
||||
See the [Testing the engine](../../engine/testing/Testing-the-engine.md) wiki.
|
||||
@@ -227,4 +227,4 @@ When writing tests, think about the developer who will read this test 6 months f
|
||||
|
||||
# See also
|
||||
|
||||
- [Flutter Test Fonts](https://github.com/flutter/flutter/wiki/Flutter-Test-Fonts)
|
||||
- [Flutter Test Fonts](Flutter-Test-Fonts.md)
|
||||
|
||||
@@ -5,16 +5,14 @@ _(This page is referenced by comments in the Flutter codebase.)_
|
||||
Golden file tests for `package:flutter` use [Flutter Gold](https://flutter-gold.skia.org/?query=source_type%3Dflutter) for baseline and version management of golden files. This allows for golden file testing on Linux, Windows, MacOS and Web, which accounts for the occasional subtle rendering differences between these platforms.
|
||||
|
||||
## Index
|
||||
- [Known Issues](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter#known-issues)
|
||||
- [Build Breakage](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter#build-breakage)
|
||||
- [Creating a New Golden File Test](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package%3Aflutter#creating-a-new-golden-file-test)
|
||||
- [Updating a Golden File Test](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package%3Aflutter#updating-a-golden-file-test
|
||||
)
|
||||
- [Flutter Gold Login](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package%3Aflutter#flutter-gold-login
|
||||
)
|
||||
- [`flutter-gold` Check](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter#flutter-gold-check)
|
||||
- [`reduced-test-set` tag](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter#reduced-test-set-tag)
|
||||
- [Troubleshooting](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter#troubleshooting)
|
||||
- [Known Issues](#known-issues)
|
||||
- [Build Breakage](#build-breakage)
|
||||
- [Creating a New Golden File Test](#creating-a-new-golden-file-test)
|
||||
- [Updating a Golden File Test](#updating-a-golden-file-test)
|
||||
- [Flutter Gold Login](#flutter-gold-login)
|
||||
- [`flutter-gold` Check](#flutter-gold-check)
|
||||
- [`reduced-test-set` tag](#reduced-test-set-tag)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
|
||||
|
||||
## Known Issues
|
||||
@@ -30,6 +28,8 @@ If you would like to instantly invalidate all prior renderings, changing the nam
|
||||
|
||||
If the Flutter build is broken due to a golden file test failure, this typically means an image change has landed without being triaged. Golden file images should be triaged in pre-submit before a change lands (as described in the steps below). If this process is not followed, a test with an unapproved golden file image will fail in post-submit testing. This will present in the following error message:
|
||||
|
||||
<!-- TODO(Piinks): Update this error message in the framework. -->
|
||||
|
||||
```
|
||||
Skia Gold received an unapproved image in post-submit
|
||||
testing. Golden file images in flutter/flutter are triaged
|
||||
@@ -91,7 +91,7 @@ And that’s it! Your new golden file(s) will be checked in as the baseline(s) f
|
||||
|
||||
## Flutter Gold Login
|
||||
|
||||
Triage permission is currently restricted to members of *flutter-hackers*. For more information, see [Contributor Access](https://github.com/flutter/flutter/wiki/Contributor-access).
|
||||
Triage permission is currently restricted to members of *flutter-hackers*. For more information, see [Contributor Access](../Contributor-access.md).
|
||||
Once you have been added as an authorized user for Flutter Gold, you can log in through the [homepage of the Flutter Gold dashboard](https://flutter-gold.skia.org/) and proceed to triage your image results under [Changelists](https://flutter-gold.skia.org/changelists).
|
||||
|
||||
## `flutter gold` Check
|
||||
|
||||
Reference in New Issue
Block a user