project1-5 / bt

Java BitTorrent library with DHT, magnet links, encryption and more
http://atomashpolskiy.github.io/bt/
Apache License 2.0
0 stars 0 forks source link

Using JaCoCo for code coverage #5

Open jsjolen opened 5 years ago

jsjolen commented 5 years ago

JaCoCo is the code coverage tool that atomashpolskiy/bt uses for its tests. This is what we should use when doing code coverage.

jsjolen commented 5 years ago

http://tdongsi.github.io/blog/2017/09/23/jacoco-in-maven-project/

jsjolen commented 5 years ago

mvn clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent install org.jacoco:jacoco-maven-plugin:0.7.8:report

This is the best I've gotten haha :-/

jsjolen commented 5 years ago

YEEES, I got it!

mvn -U clean install -Pcodecov 2>&1

Run this and you'll get the jacoco.exec files in every sub-directory's target directory.

jsjolen commented 5 years ago

The instructions are strange and does mention open source coverage tools, but it seems that this is not actually something we're supposed to do. We're only supposed to write an ad-hoc one ourselves. Soo, closing this anyway.

jsjolen commented 5 years ago

Apparently we should be able to compare with automated tools.

The easiest way to use this is with IntelliJ IDEA and installing the coverage plugins, select all jacoco.exec files in the package's target/ directory and then Analyze -> Present code coverage (or something like taht, you can figure it out)