JaCoCo ceg kev pab them nqi yog dab tsi?
JaCoCo ceg kev pab them nqi yog dab tsi?

Video: JaCoCo ceg kev pab them nqi yog dab tsi?

Video: JaCoCo ceg kev pab them nqi yog dab tsi?
Video: Евгений Мандриков — Воркшоп (часть 2): Покрытие кода в JVM 2024, Kaum ib hlis
Anonim

JaCov feem ntau muab peb qhov kev ntsuas tseem ceeb: Kab kev pab them nqi qhia txog tus lej code uas tau siv raws li tus naj npawb ntawm Java byte code cov lus qhia hu ua los ntawm kev xeem. Cov ceg npog qhia qhov feem pua ntawm kev tawm dag zog ceg nyob rau hauv cov cai - feem ntau hais txog yog / lwm yam thiab hloov cov nqe lus.

Raws li kev sib raug zoo, ceg kev pab them nqi kho mob yog dab tsi?

ceg kev pab them nqi yog ib txoj kev sim, uas lub hom phiaj los xyuas kom meej tias txhua qhov ua tau ceg los ntawm txhua qhov kev txiav txim siab tau ua tiav tsawg kawg ib zaug thiab ua kom ntseeg tau tias txhua qhov tuaj yeem ncav cuag code raug tua. Ntawd yog, txhua ceg coj txhua txoj kev, muaj tseeb thiab tsis tseeb.

Ib sab saum toj no, JaCoCo siv rau dab tsi? Peb siv tus JaCov Maven plugin rau ob lub hom phiaj: Nws muab rau peb nkag mus rau lub JaCov runtime tus neeg saib xyuas uas sau cov ntaub ntawv kev pab them nqi. Nws tsim cov ntaub ntawv qhia txog kev pab them nqi kho mob los ntawm cov ntaub ntawv raug kaw los ntawm tus JaCov runtime tus neeg sawv cev.

Ib yam li ntawd, koj tuaj yeem nug, JaCoCo yog dab tsi thiab nws ua haujlwm li cas?

Java Agent. JaCov siv cov ntaub ntawv hauv chav kawm ntawv los sau cov ntaub ntawv kev pab them nqi kho mob. Cov ntaub ntawv hauv chav kawm yog ntsuas ntawm-tus-fly siv lub npe hu ua Java tus neeg sawv cev. Cov txheej txheem no tso cai rau hauv-nco ua ntej ntawm tag nrho cov ntaub ntawv hauv chav kawm thaum lub sijhawm thauj khoom hauv chav kawm tsis pub dhau ntawm daim ntawv thov.

Ceg kev pab cuam ntsuas li cas?

Pom ob qhov ntsuas, kab kev pab them nqi thiab ceg kev pab them nqi . Koj tuaj yeem pom lawv suav li cas. Siv cov kab Cover thiab faib rau hauv cov kab Coverable thiab koj tau kab kev pab them nqi feem pua. Noj cov npog ceg thiab muab faib rau hauv tag nrho ceg thiab koj muaj ceg kev pab them nqi raws li feem pua.

Pom zoo: