From dde1849f04ba58d562dc15c268161fad5a846cbc Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:02:29 -0800 Subject: [PATCH] Add instructions for getting code coverage in Android Studio (flutter/engine#51105) small readme change, because for whatever reason we need to apply the comment from this hero https://github.com/robolectric/robolectric/issues/3023#issuecomment-1326870713 to make code coverage work [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- engine/src/flutter/shell/platform/android/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/README.md b/engine/src/flutter/shell/platform/android/README.md index d4395e64265..0a67a370a2c 100644 --- a/engine/src/flutter/shell/platform/android/README.md +++ b/engine/src/flutter/shell/platform/android/README.md @@ -215,7 +215,12 @@ Android Studio: ![Example](https://github.com/flutter/flutter/assets/168174/02fe0e6f-f0c4-47b2-8dae-9aa0b9520503) At this point you should be able to open Java files in Android Studio and get -code completion in the `io/flutter` folder (additional, undocumented work is -required for `test/io/flutter`). For example, `FlutterJNI.java`: +code completion in the `io/flutter` and `test/io/flutter` folders. For example, `FlutterJNI.java`: ![Example](https://github.com/flutter/flutter/assets/168174/387550d4-eab7-4097-9da3-7713a6ec4da7) + +To get code coverage displayed in line: go to the test class you wish to run and +1. Right click > Modify Run Configuration..., +2. In the window that pops up click Modify options > Specify classes +and packages (under "code coverage"). +3. In the new box that appears at the bottom of the window, click the + > Add package, and then add `io.flutter.*`.