# PiTest Plugin For Intellij ## Initoption Setting - Step1: Plugin Download (Plugin name :PIT Mutation Testing) ![image](https://hackmd.io/_uploads/Hkd6oXo3T.png) - Step2: choose Edit Configurations ![image](https://hackmd.io/_uploads/ryh8nmonp.png) - Step3: create a new VM,select the PIT Runner ![image](https://hackmd.io/_uploads/r1Gh37snT.png) - Step4: setting your current VM Options,and Run it ![image](https://hackmd.io/_uploads/SJ5eAXjha.png) --- ## How to use - Step1: 右鍵點選要測試的類別 -> 可以選擇整個Module或是單一類別 ![image](https://hackmd.io/_uploads/rJhuF_p26.png) - Step2: 承Step1,點選後,會自動跑測試,報告會依照設定的路徑產出以及顯示測試覆蓋率 ![image](https://hackmd.io/_uploads/SyXX5upnp.png) - Step3: 選擇index.html即可看到報告產出結果 ![image](https://hackmd.io/_uploads/BJN8yYan6.png) --- ## Report Introduce #### ==index== ![image](https://hackmd.io/_uploads/HypW3_ahT.png) #### ==detail== ![image](https://hackmd.io/_uploads/SJ_X2d62T.png) ### ==comment== - source code ![image](https://hackmd.io/_uploads/Sy3bJtThp.png) --- ## Comment - PiTest有提供諸多客製化設定,簡略舉例如下: - reportDir -> 報告產出目錄 - targetClasses -> 測試目標類 - threads -> 自定義執行緒數量 - historyOutputLocation ->歷史紀錄目錄位置 - 官網提供設定範例 ``` grovvy java -cp <your classpath> \ org.pitest.mutationtest.commandline.MutationCoverageReport \ --reportDir c:\\mutationReports \ --targetClasses example.foo.* \ --sourceDirs c:\\myProject\\src \ --targetTests example.foo* --threads 2 --excludedMethods hashCode,equals ``` - Intellij有提供Plugin,其中可以將原先要寫在build.gradle或pox.xml裡面的資訊,改以parameter方式設定,並以,隔開.範例如下 ![image](https://hackmd.io/_uploads/rywV0ua26.png) - Document Source -> https://pitest.org/quickstart/commandline/