Missing Code Coverage annotation in Apex classes

Issue #2322 duplicate
Roman Hentschke created an issue

Hi @Scott Wells

maybe I am just missing a setting or something similar. But since some time I cannot find the annotations for apex test code coverage in an apex class… “In the old days” when we run apex tests with code coverage an open apex class got this nice little colored vertical lines on the left side near the line numbers indicating which line has been covered by a unit test which just ran.

Where are these lines gone? :-(

We have a workaround - but it is so much clicking

Right click in the editor window → Illuminated Cloud → Show Coverage data → select the result → Hit Button show selected

Is there a setting we are missing to automatically show the coverage data (again)?

Comments (11)

  1. Scott Wells repo owner

    That’s one of the ways to show coverage, the other being a unit test run with coverage. Can you please enable debug logging for Code Coverage, reproduce the issue, and attach the resulting idea.log here for review?

  2. Scott Wells repo owner

    Thank you. It certainly looks like it’s retrieved coverage information from the org and is trying to apply that information in the IDE, e.g.:

    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite - Processing line data for ApexClass:MASTERAGREEMENTLINEITEMSSERVICEIMPL
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Getting or creating class data
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Getting the line count
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite - Getting the line count for class/trigger ApexClass:MASTERAGREEMENTLINEITEMSSERVICEIMPL
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Searching for the symbol as a class.
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Found matching class or trigger: /Users/roman/development/mytestproject/unpackaged/main/default/classes/services/MasterAgreementLineItemsServiceImpl.cls
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   File /Users/roman/development/mytestproject/unpackaged/main/default/classes/services/MasterAgreementLineItemsServiceImpl.cls is under source root /Users/roman/development/mytestproject/unpackaged/main/default.
    ...
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   /Users/roman/development/mytestproject/unpackaged/main/default/classes/services/MasterAgreementLineItemsServiceImpl.cls: isOstDeclaration = false; isTopLevelClassDeclaration = true; isTriggerDeclaration = false
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Using declaration MasterAgreementLineItemsServiceImpl from file /Users/roman/development/mytestproject/unpackaged/main/default/classes/services/MasterAgreementLineItemsServiceImpl.cls.
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Line count = 28
    2023-02-13 18:36:27,521 [8209286]   FINE - #com.illuminatedcloud.intellij.coverage.ApexCoverageSuite -   Added line data = { 10 uncovered, 11 uncovered, 12 uncovered, 13 uncovered, 14 uncovered, 17 uncovered, 18 uncovered, 19 uncovered, 20 uncovered, 21 uncovered, 23 uncovered, 25 uncovered, 26 uncovered }
    

    Two additional questions for you:

    1. What version of IC2 and the underlying JetBrains IDE are you using? If not the absolute latest of both, please update as appropriate and see if the problem still occurs.
    2. Assuming that you’re either already completely up-to-date or the problem still occurs after updating, can you please reproduce once more and provide all idea*.log* files from the timeframe of the reproduction and also provide the exact steps you’re taking to show coverage…which are likely just the ones from the original issue details, but I’d like to know exactly what actions are behind the logs I’ll be reviewing.

  3. Roman Hentschke reporter

    IntelliJ Version: 2022.3.2

    IC2 Version: 2.2.5.6

    I have the feeling, that this behaviour started, after I’ve switched to the “New UI” of IntelliJ No, I just tested it, by switching back to the old UI. Same behaviour…

    What’s interesting though is, that the code coverage becomes visible for a second or two… See the GIF, which I’ve attached.

    I will provide the logs, but I need a moment to clean them up from any customer related information ;-)

  4. Roman Hentschke reporter

    To your second request:

    • There is only one idea.log file (attached again)
    • I open a random unit test class
    • I click on the little arrow next to the class name and select Run “Unit Test Class Name” with Code Coverage
    • While the tests of this class run, I’ll switch the tab to the class which is currently under test
    • After the test methods finished, code coverage becomes visible for a second or two (see GIF) and then disappears again

    Workaround:

    • Right click on the currently tested APEX class
    • Select → Illuminated Cloud → Show Coverage data → select the result → Hit Button show selected
    • Test coverage for this single class becomes visible again (and does not disappear)

  5. Scott Wells repo owner

    Okay, that description helps. You’re seeing the exact same issue a small handful of others have seen. It’s tracked in #2142 so I’m merging this issue into that one as a duplicate. Unfortunately I haven’t found any obvious reason for the coverage closing after “Run with coverage” but staying open when activated explicitly via “Show coverage data”. I’ll see if your logs provide any new insights, and I may ask you for additional ones, likely via #2142 so please add yourself as a watcher on that issue as well.

  6. Log in to comment