eclipse代碼的紅綠黃背景顏色——利用 Coverage 查看代碼的 session覆蓋率 和 決策分支執行覆蓋情況


直接上圖,最近發現eclipse一個比較方便的功能,叫 Coverage。可以直接查看代碼塊 和 決策分支 成功運行后的覆蓋率情況。

Source lines containing executable code get the following color code:(可執行的源代碼塊附帶的顏色是這么一回事 :)

green for fully covered lines,(綠色是完全100%覆蓋)
yellow for partly covered lines (some instructions or branches missed) and(黃色是部分覆蓋,有時是因為語句或分支丟失了)
red for lines that have not been executed at all.(紅色的代表沒執行過)
In addition colored diamonds are shown at the left for lines containing decision branches. The colors for the diamonds have a similar semantic than the line highlighting colors:(行數左邊那顆鑽石的顏色表示為:)

green for fully covered branches,(綠色是完全執行的決策分支)
yellow for partly covered branches and(黃色是部分執行的決策分支)
red when no branches in the particular line have been executed.(紅色是某行沒有執行過的決策分支)
· 啟用:

1.在 Run --> Coverage Configuration/Coverage ... 可以進行設置:

2. 勾上需要 Coverage 的文件/文件夾。

3. 按 Ctrl + Shift + F11,就可以運行啦。

· 關閉:

只需要 在Coverage 窗口把 Remove All Session 點掉就ok了。

https://www.eclemma.org/userdoc/annotations.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM