- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有人找到忽略琐碎方法的好解决方案了吗?
使用一些自动化测试,如 Unitils
这不是一个真正的选择,因为如果只测试 getter/setter,代码覆盖率不应上升!
使用 cobertrua-maven-plugin 版本 2.5.1:
-) 忽略方法不起作用 <ignore>com.company.*.set*</ignore>
-) 有没有人尝试包含像 http://sourceforge.net/tracker/index.php?func=detail&aid=3010530&group_id=130558&atid=720017 这样的补丁进入 maven 插件?
-) 有人使用不同的(更好的?)测试插件吗?
一般忽略每个 get/set/is* 方法也不是真正的好方法,因为这些模式可以用于其他方法,但 simle getter/setter。此外,应该很容易猜出琐碎的 getters/setters/constructors。
我知道这个问题:Ignore methods in class. cobertura maven plugin但由于它没有得到任何相关答案,我想我再试一次。
最佳答案
从 Cobertura 2.0 开始,有一个开关可以排除琐碎的方法:
[Cobertura Changelog] New --ignoreTrivial switch that tells Cobertura to ignore the following in the coverage report: Getter methods that simply read a class field; Setter methods that set a class field; Constructors that only set class fields and call a super class constructor.
cobertura-maven-plugin 使用 Cobertura 2.x 自版本 2.6(参见 release notes)。但是我还没有找到将开关传递给 Maven 插件配置的方法。
尽管此功能的状态似乎有些困惑(请参阅 Jira issue),但该标志似乎适用于以下配置:
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<ignoreTrivial>true</ignoreTrivial>
</instrumentation>
</configuration>
关于testing - 是否仍然没有使用 cobertura-maven-plugin 忽略 setter/getter(其他琐碎的方法)的解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9261731/
我认为这相对简单,但我很困惑,因为我是类图的新手。 我将要创建一个程序(用 Java)来管理麦当劳的员工类型。因此,考虑为对象建模。 为了简单起见,麦当劳只有两种员工,“主管”和“船员”,两者都是按月
我有一个很小的 Android 项目,是我拼凑而成的,用于了解 Android 单元和仪器测试。我使用dog.ceo API 来获取狗的随机图像。程序本身按其应有的方式运行。但是,每当我运行或调试
我是一名优秀的程序员,十分优秀!