dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.99k stars 1.54k forks source link

Area for Improvement: Better support for code coverage analysis #54977

Open bkonyi opened 5 months ago

bkonyi commented 5 months ago

It’s important to have an understanding of code coverage as it can give a high level overview of a project’s code health and test coverage. While Dart and Flutter do provide ways to collect code coverage, there’s very little support for displaying code coverage information in tooling. The code coverage support that is available in DevTools is limited to the source viewer in the Debugger screen, which is hidden by default when accessed from IDEs, meaning that it’s available to very few developers.

To make code coverage information more accessible to developers, the tooling team should consider creating code coverage tooling that can be embedded in VSCode. At its simplest, this tooling could be a sidebar tool that displays high-level coverage information after running tests. Coverage could be broken down by class, method, and line number, similarly to what is done in Android Studio:

image

Ideally, visual indicators for covered lines would also be shown in the source code viewer, which should be possible to do in VSCode.

orestesgaolin commented 4 months ago

My suggestion is to navigate users to following tools to view code coverage, as they have been industry standard for many years. Personally, I wouldn't expect Dart tools to include code coverage analysis tooling.

I think redirecting users to use lcov or similar tools should be endorsed.