I am using hudson CI to manage a straight java web project, using ant to build.

我正在使用hudson CI来管理一个直接的java web项目,使用ant来构建。

I would like to mandate that the unit test coverage never be worse than the previous build, thereby making sure any new code is always tested, or at least the coverage is continually improving.

我想强制要求单元测试覆盖率永远不会比以前的构建差,从而确保始终测试任何新代码,或者至少覆盖范围不断改进。

Is there a hudson plugin that works this way?

是否有一个以这种方式工作的哈德森插件?

Edit: I am currently using Emma, but would be willing to switch to another coverage app.

编辑:我目前正在使用艾玛,但愿意切换到另一个覆盖应用程序。

Also, as a clarification, I've seen the thresholds in some Hudson plugins, but that's not exactly what I'm after. For example what I'd like is that if coverage for Build #12 was 46% overall, and someone checked in Build #13 with 45% coverage, the build would break.

另外,作为一个澄清,我已经看到了一些Hudson插件的阈值,但这并不是我所追求的。例如,我想要的是,如果Build#12的覆盖率总体上是46%,并且有人在Build#13中检查了45%的覆盖率,则构建将会中断。

The reason I want to do this, is that I have a codebase with low test coverage. We don't have time to go back and retroactively write unit tests, but I'd like to make sure that the coverage keeps getting better.

我想这样做的原因是我有一个测试覆盖率低的代码库。我们没有时间回过头来追溯写单元测试,但我想确保覆盖率不断提高。

UPDATE: Dan pointed out an edge case with my plan that will definitely be a problem. I think I need to rethink whether this is even a good idea.

更新:Dan用我的计划指出了一个边缘案例肯定会成为一个问题。我想我需要重新考虑这是否是一个好主意。

4 个解决方案

#1


Yes. Which coverage tool are you using?

是。您使用的是哪种覆盖工具?

The Cobertura plugin for Hudson definitely supports this. On the project configuration screen you can specify thresholds.

Hudson的Cobertura插件肯定支持这一点。在项目配置屏幕上,您可以指定阈值。

Alternatively, you can make Ant fail the build (rather than Hudson), by using the cobertura-check task.

或者,您可以通过使用cobertura-check任务使Ant失败构建(而不是Hudson)。

EDIT: I'm not sure you can do precisely what you are asking for. Even if you could, it could prove problematic. For example, assume you have an average coverage of 75% but for one class you have coverage of 80%. If you remove that 80% class and all of its tests, you reduce the overall coverage percentage even though none of the other code is any less tested than previously.

编辑:我不确定你能做到正是你所要求的。即使你可以,也可能证明是有问题的。例如,假设您的平均覆盖率为75%,但对于一个级别,您的覆盖率为80%。如果删除该80%的类及其所有测试,则会降低整体覆盖百分比,即使其他代码都没有比以前更少的测试。

更多相关文章

  1. 基于Java的应用程序的GUI测试工具
  2. 测试技术大牛谈成长经历:一个好的软件测试工程师应该做到这些!
  3. java高并发测试实例(精确到几百纳秒)
  4. 在Java中,使用DefaultSelenium对象在selenium中启动测试,我如何找

随机推荐

  1. android图像处理系列之三--图片色调饱和度
  2. Android(安卓)adbd配置
  3. tools:context =“activityname”布局文
  4. [原]android 中如何飞行模式的几个操作
  5. Android 图片缩放与旋转
  6. 进度条及拖动条背景颜色设置(progressDraw
  7. Android windowSoftInputMode属性解析
  8. mapView 和textView布局
  9. Android 中文 API (100) —— ScrollView
  10. android---------ndk中的各个版本的下载