由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - java 写unit test 给clover 真就是农民阿
相关主题
java code coverage 现在都用什么传递一个object reference,如何防止更改object?
Basic thread questionhow to solve the problem: the members change by each other .
Converge of languages and design pattern一个多线程问题
请问如何避免这样的stylegit clones only one branch?
array 在java里 是一定放在heap 吗?发现java码工有个好处
Help请教关于使用map和fields
What's good way to pass intermediate results?get输出到Json
Simple questionJava Performance Tool
相关话题的讨论汇总
话题: coverage话题: test话题: clover话题: true话题: branch
进入Java版参与讨论
1 (共1页)
c******n
发帖数: 4965
1
暴无聊,看到coverage 到90% 以下了,
看report, 红条的代码,一条条照抄加到test code 里面去,
我才领会到"码农/硅工“这词的含义
m******t
发帖数: 2416
2
Coverage reports are supposed to be reviewed by human beings.
Core code has to have 100% coverage (maybe excluding crazy exceptions).
Getters and setters don't need to be covered at all.

【在 c******n 的大作中提到】
: 暴无聊,看到coverage 到90% 以下了,
: 看report, 红条的代码,一条条照抄加到test code 里面去,
: 我才领会到"码农/硅工“这词的含义

s******e
发帖数: 493
3
The funny part of clover is that it is too damn "clever"
it will think that you miss the coverage if you have code like below but
only test the "if" branch (coverage)
if (true)
{
doSomething();
}
It will be complaining that you miss testing "if(false)" even you want to do
nothing.
m******t
发帖数: 2416
4
Are you sure? I thought if (true) would always get optimized away these
days.

do

【在 s******e 的大作中提到】
: The funny part of clover is that it is too damn "clever"
: it will think that you miss the coverage if you have code like below but
: only test the "if" branch (coverage)
: if (true)
: {
: doSomething();
: }
: It will be complaining that you miss testing "if(false)" even you want to do
: nothing.

s******e
发帖数: 493
5
I really did not mean the literal value "true" when I said if(true). I meant
something evaluated to be true. If your question is about the evaluated
expression. Yes I am sure.
Q**g
发帖数: 183
6
nothing special here. line coverage vs branch coverage

do

【在 s******e 的大作中提到】
: The funny part of clover is that it is too damn "clever"
: it will think that you miss the coverage if you have code like below but
: only test the "if" branch (coverage)
: if (true)
: {
: doSomething();
: }
: It will be complaining that you miss testing "if(false)" even you want to do
: nothing.

s******e
发帖数: 493
7
well you will feel it "very special" if you have a team policy of 100%
coverage, and for the case where you need to mockito many, many things to
test the nonexisting branch.
m******t
发帖数: 2416
8

Well... no... if it's a branch that really could go either way, then you
gotta
test both. I agree that it can be painful, compounded by a 100% coverage
policy, but it doesn't sound reasonable to blame the tool for reporting it.

【在 s******e 的大作中提到】
: well you will feel it "very special" if you have a team policy of 100%
: coverage, and for the case where you need to mockito many, many things to
: test the nonexisting branch.

1 (共1页)
进入Java版参与讨论
相关主题
Java Performance Toolarray 在java里 是一定放在heap 吗?
java覆盖率测试工具?Help
jmock ?? or any other mocking tools?What's good way to pass intermediate results?
也问个 HashMap问题Simple question
java code coverage 现在都用什么传递一个object reference,如何防止更改object?
Basic thread questionhow to solve the problem: the members change by each other .
Converge of languages and design pattern一个多线程问题
请问如何避免这样的stylegit clones only one branch?
相关话题的讨论汇总
话题: coverage话题: test话题: clover话题: true话题: branch