休眠升级后代码覆盖率明显下降

编程入门 行业动态 更新时间:2024-10-27 08:26:39
休眠升级后代码覆盖率明显下降 - 吸气剂和孵化器未被覆盖 - 任何想法?(Code coverage going down significantly after hibernate upgrade - getters and setters not covered - any ideas?)

我们最近将代码库从2005版本升级到最新版本的hibernate。

因此,我们看到许多软件包的代码覆盖率显着降低。 这些包几乎完全是映射到hibernate对象的POJO,差异似乎在于getter和setter的覆盖范围。 大多数这些对象都不是直接进行单元测试的,所以之前的覆盖范围大多来自于它们在某些集成测试中的使用,导致hibernate击中这些getter和setter。

有没有人见过类似的事情? hibernate填充那些可以解释这些对象的方式有没有改变?

大多数字段都设置为lazy = false,因此这可能是不可能的。

我们正在使用testng,cobertura和jdk 1.6。

We have recently upgraded our code base from a 2005 version to the latest version of hibernate.

As a result of that, we're seeing significantly reduced code coverage in a number of our packages. These packages are almost entirely POJOs mapped to hibernate objects, and the difference seems to be in the coverage of getters and setters. Most of these objects are not directly unit tested, so the previous coverage most have come from their usage in some integration test causing hibernate to hit these getters and setters.

Has anyone seen similar things happening? Has there been a change in the way hibernate populates those objects that could explain that?

Most of the fields are set to lazy=false so that's probably out of question.

We are using testng, cobertura and jdk 1.6.

最满意答案

有人改变了xml中的某些内容来改变对字段的访问,例如

<property name="xxx" ... access="field"/>

还是像这样全球?

<hibernate-mapping ... default-access="field">

默认情况下,hibernate的访问权限设置为property,因此应该使用提供它们的访问器。

Has somebody changed something in the xml to change the access to field, e.g.

<property name="xxx" ... access="field"/>

or globally like this?

<hibernate-mapping ... default-access="field">

By default hibernate's access is set to property, so that should use accessors where they are provided.

更多推荐

本文发布于:2023-08-02 01:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1368030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:覆盖率   代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!