How can the code coverage data from Flutter tests be displayed?

后端 未结 6 665
别那么骄傲
别那么骄傲 2020-12-25 11:23

I\'m working on a Flutter app using Android Studio as my IDE.
I\'m attempting to write tests and check the code coverage but I can\'t work out how to view the data in th

6条回答
  •  北海茫月
    2020-12-25 12:14

    So, the actual answer is no, you cannot view a coverage report within Android Studio (or in IntelliJ IDEA) at this time.

    Unlike JavaScript/TypeScript and Java and probably Python, the IntelliJ IDE (and by extension, Android Studio) do not have integrated IDE support for showing test coverage of Flutter code in the editor. This is a shame because the ability to see your untested code branches and lines highlighted in the source code of your editor is a beautiful thing. Not sure why a plugin for this does not exist yet, since it is well-supported for other languages, and a standard lcov.info file is generated.

    There is a bundled code coverage tool window in IntelliJ that is supposed to allow you to browse the lcov.info file in a tree/table drill-down format, but it doesn't seem to work with the coverage report generated by flutter (flutter test --coverage). I thought it might be the relative paths in the lcov.info and my multi-module app structure, but I tried to manually edit the file paths in lcov.info, but I had no luck getting the stats to show.

提交回复
热议问题