Jenkins的代码覆盖率 [英] Code Coverage with Jenkins

查看:166
本文介绍了Jenkins的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

系统要求我使用Jenkins测试Java项目的代码覆盖率.问题是我从未使用过Jenkins,并且几乎没有实际的代码覆盖经验.我一直在搜索,并且遇到了JaCoCo和Cobertura作为插件.问题在于,此时此刻,谈论他们的一切都超出了我的想象.我的问题是,据我了解,Jenkins和JaCoCo/Cobertura用于运行测试(Junit?),并报告处理我的代码的性能如何,但是它们从哪里得到测试?显然我应该制作它们,但是这些又是什么样的文件(再次是Junit?),这些工具又是如何获取它们的?

I am being asked to use Jenkins to test code coverage for a Java Project. The issue is I have never used Jenkins and have scarcely little experience with actual code coverage. I have been searching a bit and I have come across JaCoCo and Cobertura as plugs. The issue is everything talking about them is above my head at this point. My question is this, as I understand it Jenkins and JaCoCo/Cobertura are used to run tests(Junit?), and report on how well the handle my code, but where do they get the test? Obviously I should make them, but what kind of files are these(again Junit?) and how do the tools get them?

如果您感觉很慷慨,那么这些工具是否有很好的入门级教程?

If you are feeling generous, are there any good introduction level tutorials for these tools?

推荐答案

也许尝试朝这个方向看:

Maybe try looking in this direction:

  • 希望您的项目是 maven 项目
  • 使用Jenkins(您已经这样做了)
  • 使用声纳
  • May your project be maven project
  • Use Jenkins (you already do)
  • Use Sonar

声纳:

  • More about: http://www.sonarsource.org/manage-code-coverage-by-unit-tests-with-sonar/
  • Download from: http://sonar-pkg.sourceforge.net/

有很多关于如何使用Jenkins + Sonar的教程,所以我想您不会有太多麻烦. Sonar是一种非常强大的工具,是迄今为止我见过的最好的工具之一.并且有一个Jenkins插件(但可以通过maven项目的 pom.xml 文件中的某些 profile 避免使用该插件).

There are lot of tutorials how to use Jenkins+Sonar so I guess you will not have much trouble. Sonar is really powerful tool, one of the best I've seen so far. And there is a plugin for Jenkins (but it can be avoided with certain profile in your maven project's pom.xml file).

这篇关于Jenkins的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆