用于查檢單元測試的代碼覆蓋率的
1. 安裝
File > Settings > Plugins > Browse repositories
輸入'Atlassian Clover for IDEA' 點擊 'Install',重新啟動idea

Paste_Image.png
2. 申請clover的free license(30-day)
File > Settings > Build, Execution, Deployment > Clover(global settings) > License
點擊“generate an evaluation license”,打開atlassian網(wǎng)站

Paste_Image.png
3. 申請license
要先確保在atlassian有帳戶,選擇product為clover,點擊[Generate License]

Paste_Image.png
復(fù)制license,粘貼到IDEA中,點擊[Verify],驗證通過,會顯示license的過期時間

Paste_Image.png

Paste_Image.png
重啟動后,項目的左邊多兩標(biāo)簽 cloverage和test runs

Paste_Image.png
4. Clover的使用
將鼠標(biāo)放到要進(jìn)行覆蓋率統(tǒng)計的代碼文件或文件夾上右擊,點擊”change Exclusion”,選擇include,測試代碼也要include,才能統(tǒng)計出測試結(jié)果。

Paste_Image.png
5. 運行測試腳本
運行測試腳本

Paste_Image.png
6. 查看結(jié)果
點擊cloverage標(biāo)簽,查看代碼覆蓋情況

Paste_Image.png
點擊左側(cè)test runs,進(jìn)行查看測試結(jié)果

Paste_Image.png
7. 導(dǎo)出Clover報告
在cloveraged面板中,點擊”generate clover report”導(dǎo)出報告

Paste_Image.png

Paste_Image.png