Intellij Idea 如何显示测试覆盖线

Intellij Idea How to show tests covering line

我正在使用 IDEA 来分析我们的代码覆盖率。 我可以看到某些行被调用了 N 次。但我也想知道是哪个测试导致了那条线路呼叫。 我看到了相应的按钮 "Show tests covering line",但是所有行都禁用了该按钮。

那么这种行为的原因是什么,是否有可能强制 IDEA 显示调用特定代码行的测试

来自the docs

This button is only available in the Tracing mode, and with the Track per test coverage check box selected

您可以在 Run/Debug window 中启用跟踪和 'track test per coverage'。这是屏幕截图:

更多详情in the docs