eclipse 有测试代码覆盖率的功能,也就是执行Run——>Coverage后会出现这样字体背景变红/变绿/变黄的效果
如何清除
网上有说随便更改下代码就好了,也有说重启IDE,这些办法确实可行,只是不知其所以然而已。
最佳解决办法是打开Coverage的视图,然后点击Remove all Sessions(两个×按钮)
步骤一 Window —>show view —> Other—>Java—>Coverage
步骤二 点击Remove all Sessions(两个×按钮)
1
2
针对步骤一,也可以在右侧工具栏中直接点击”Coverage”图标,来打开Coverage的视图
另外有关覆盖测试的颜色含义如下
Source lines containing executable code get the following color code:
1.green for fully covered lines,
2.yellow for partly covered lines (some instructions or branches missed) and
3.red for lines that have not been executed at all.
1
2
3
4
即:
绿色为完全覆盖的线条,
黄色部分覆盖的线条(一些指示或分支遗漏)
红色表示尚未执行的行。
作者:Casionx
来源:CSDN
原文:https://blog.csdn.net/summerxiachen/article/details/79921400