Tool for java code coverage on GitHub [closed]

自闭症网瘾萝莉.ら 提交于 2019-12-06 05:11:30

问题


I have a Java project created in IntelliJ and using Gradle.

My repository is hosted on GitHub, I've also integrated Travis CI.

My tests are done using JUnit and Mockito, Java 8.

I'm looking for a tool that would automatically run tests whenever I push to my repository, providing me with information if tests passed and code coverage information. Would like it to generate a GitHub badge just like Travis CI does, so that I can see how each branch is covered and if it's passing.

Thanks!


回答1:


I use JaCoCo to capture coverage statistics which get published to Coveralls to track coverage changes between builds and visualize the results. Coveralls also provides a badge with a coverage percentage.

Gradle/Travis/Github examples here and here




回答2:


I decided to go with Codecov

Here's my GitHub repo with example implementation.




回答3:


With https://codecov.io/, the official example here is more up to date compared to the best answer: https://github.com/codecov/example-gradle

However, I the CodeCov badge is set up in a nice way in the best answer's code, compared to the official examples which seem to have no badge in the README.

EDIT: After trying to set up all of this, I really disrecommend using CodeCov for private repos (although it can work well for public repos). Full of bugs. Very mad.



来源:https://stackoverflow.com/questions/38867350/tool-for-java-code-coverage-on-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!