Expose which test methods cover a line of apex

Issue #1352 resolved
James Melville created an issue

When test methods have been run in IC2 a green or red marker is added to the gutter. Clicking on the marker gives a small widget which shows the text “Hits: 1” if the code is covered by one or more test method(s) (i.e. it’s always 1 even when covered by multiple test methods).

It would be really useful if the text actually showed a list of test methods (with their class name (and namespace?)) which cover this line number. The list should be clickable so I can navigate directly to the test method.

Bonus points:

Provide a picker like dev console which allows you to choose which methods (or all) is used in coverage highlighting. Which method is selected should not affect the previous methods per line functionality.

Comments (3)

  1. Scott Wells repo owner

    One thing to point out about this implementation is that it'll always show "Hits: 1" even when there are multiple hits because the more detailed ApexCoverage information that includes the invoking test correlation details is queried lazily when you click Show Tests Covering Line. It's prohibitively expensive to query large that object on a large scale, so the normal coverage view still uses ApexCodeCoverageAggregate which doesn't include hit-level information, just whether a line has been covered or not.

  2. Scott Wells repo owner

    Delivered in with the previously-stated caveat that it doesn't work in 2020.2, though JetBrains has now stated that the underlying problem will be fixed in 2020.3 (including the next 2020.3 EAP build).

  3. Log in to comment