On Wed, Dec 9, 2009 at 1:56 PM, Si <
swes...@gmail.com> wrote:
> On Dec 9, 10:16 am, Ed Bowler <
ed.bow...@gmail.com> wrote:
>> We also use cobertura, but if you're relying on a coverage tool, you
>> probably need to go back to programmer school and learn tdd.
>
> Not exactly sure what you mean by this. Used solely for measuring
> quality, agreed. But as a tool for identifying code not covered by
> automated tests, it adds a lot of value.
Yeah ... I've made a flippant comment on the internet again haven't I
... this is probably a bad discussion to have on a mailing list, but
here we go:
if you've written some code, then you know that it's tested, cos
before you wrote any code, you wrote a test, and you're only writing
enough code to make the test pass. So any code coverage tool is just
a crutch that people can use to avoid writing tests first, because
before you check in, you can just run the coverage report, and write
enough tests so that all the lines are covered. This tends to lead to
tests that don't really test functionality, but just run the code and
make sure it doesn't throw exceptions. Also, it often leads to dead
branches of code that aren't needed, because of failure to strictly
follow the test first, one test at a time, tdd like you mean it
practice. And providing a tool in any less than ideally disciplined
environment is just encouraging bad developer behaviour.
However, I'm pretty sure that there's a rather strong argument for
using these tools on a codebase that has low test coverage, to get the
coverage up, but it doesn't remove the questions about what tests to
write, and what the system should actually do, it just tells you what
code you can delete when you've finished ;)
Having said all that, I'm not exactly totally committed to that point
of view ... it all kinda depends on the environment you develop in ...
and the codebase you have to work with, and and and ..... so ignore me
and I'll go back to sleep ;)
by the way,
http://www.infoq.com/presentations/Lessons-Learned-from-Java-EE
starts with a little history of the JEE world, so it might be worth a
watch if you wanted to start looking at things like jboss ;)