Enhancement: option to always display latest code coverage results in editor
As a user, I love to open two panes; on the left - my production code, and on the right the tests for that class. I’d love the ability to configure IC2 to automatically display the latest code coverage for a file, if it exists, so that my code coverage is automatically displayed when I run tests.
Comments (12)
-
repo owner -
repo owner - changed status to open
-
reporter ah. i’ve been running via the green triangle. I assumed that since I’ve set the checkbox to always get coverage that it would auto show it. It’s not here, but I see the green triangle has the option to run with coverage so perhaps it’s ignoring that flag?
-
repo owner If you want coverage to show immediately after test execution, you must use the Run With Coverage action. That’s just part of the underlying JetBrains IDE test/coverage framework:
https://www.jetbrains.com/help/idea/running-test-with-coverage.html
Doing so will execute the Apex tests denoting that coverage should be collected during test execution. That’s an API option and adds a very small amount of overhead to test execution, so it’s disabled by default. If you want all test executions to gather coverage, you can check the option in the screenshot above, but that will just ensure that it’s gathered on the server. It won’t automatically display coverage in the IDE upon completion unless you use the Run With Coverage action.
-
reporter Gotcha. Thats, odd. I think. not sure why jet brains would make showing coverage a two step process if you’ve configured it to always get the coverage data.
-
repo owner Always collect coverage is a Salesforce-specific option that just tells the server to measure coverage metrics during test execution no matter how you run tests. It doesn't cause anything to happen in the IDE locally. It's basically the exposure of a REST API option for the unit test API. Does that help clarify it?
-
reporter yep. I totally get the distinction between the ‘always enable collection’ and ‘actually get the coverage info’. I think what’s odd, to me, is that jet brains would handle it this way. When would i not want coverage info?
-
repo owner Ah, I see. I run unit tests all the time in the Java world without checking coverage. I circle back around to look at coverage once I have a set of tests laid out the way I want, and that can often take multiple iterations. But I get your point…it would be nice if you could designate Run With Coverage as the default behavior. And maybe you can. I'd have to dig around and see if such an option already exists. Wouldn't surprise me if it does. I'll let you know.
-
repo owner - removed version
-
repo owner This is very closely related to #1237 and could perhaps be merged as a duplicate.
-
repo owner - changed component to Apex Code Coverage
-
repo owner - changed status to duplicate
Duplicate of #1237.
- Log in to comment
If you execute tests using Run With Coverage, it will download coverage metrics and overlay them in the IDE immediately upon completion of the tests:
Does that meet the request?