Home > Archive > Extreme Programming > February 2006 > Test Coverage for only new / changed code
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Test Coverage for only new / changed code
|
|
| mzehle 2006-01-26, 7:57 am |
| Hi,
has anyone ever thought about how to measure an individuals' test
coverage?
I am especially interested in measuring the test coverage for only new
/ changed code that an individual has added. Clover does not help in
finding this out.
Would be nice to hear about your ideas!
Thank you so much,
/Martin
| |
|
| mzehle wrote:
> has anyone ever thought about how to measure an individuals' test
> coverage?
> I am especially interested in measuring the test coverage for only new
> / changed code that an individual has added. Clover does not help in
> finding this out.
Under eXtreme Programming, programmers work only in pairs, and only writing
new code if they have a failing test case. So test coverage stays
efficiently high, and everyone knows how high it is.
To learn about less efficient ways to develop, ask on
news:comp.software.testing
--
Phlip
[url]http://www.greencheese.org/Z Land[/url] <-- NOT a blog!!!
| |
| mzehle 2006-01-26, 6:59 pm |
| Hi Philip,
thank you for the reply. You may be right in projects where only new
code is developed,
but imagine, as it is in my case there is a repository with old and
working code and you have to add new functionality. The old code is not
tested and your xp-code is tested since you are a good programmer.
The class you are changing has i.e. 1000 LOC, no test coverage and you
add 10 LOC with enough tests, which makes up lets say 100% for your
lines.
The whole class then has a test coverage as calculated by clover from
10 / 1010 * 100 = 0,99%.
This is the distinction I mean, there is no automatic way to find out
the developers' test coverage. Your work is covered, but the text
coverage is blurred by the test coverage from the class.
I am looking for a tool or for someone who came across the same problem
and maybe found a solution to that.
Kind regards,
Martin
| |
|
| mzehle wrote:
> thank you for the reply. You may be right in projects where only new
> code is developed,
> but imagine, as it is in my case there is a repository with old and
> working code and you have to add new functionality. The old code is not
> tested and your xp-code is tested since you are a good programmer.
Only add new features by retrofitting tests (per /Working Effectively with
Legacy Code/ by Mike Feathers). This will add tests to the parts of the code
that are relevant to your changes. The stable behaviors in your code will
not change, and won't need tests.
This metric is much more important than raw coverage, because we need to put
80% of tests on the 20% of code that's most risky. Your strategy s s to
spread a finite number of tests over 100% of the code, evenly, without
regard to risk.
--
Phlip
[url]http://www.greencheese.org/Z Land[/url] <-- NOT a blog!!!
| |
| mzehle 2006-01-27, 3:58 am |
| I agree with you on your ideas.
What I miss is this here:
> This *metric* is much more important than raw coverage, [...]
There seems to be no tool available that can measure this. Looking
manually for the changed code and the tests takes too long time.
Combining the data from SVN / CVS and a test coverage tool there must
be some way to find this out.
| |
| Dariusz Cieslak 2006-01-30, 3:56 am |
| > has anyone ever thought about how to measure an individuals' test
> coverage?
> I am especially interested in measuring the test coverage for only new
> / changed code that an individual has added. Clover does not help in
> finding this out.
Typical coverage tools highlight lines of code that haven't been run
by tests. You can connect version constrol system (example: cvs
annotate command) with output of coverage analisys (annotated source
code) in order to show lines edited by indidvidual person that haven't
been run by automatic tests (of course this requires a bit of
scripting).
I'm using also mutation testing (stronger tool that coverage
measurment) on single modules in order to catch untested (or
insufficiently tested) code.
--
Regards, Darek Cieslak; +48 505-670-010; cieslakd at gazeta.pl
http://cieslakd.webpark.pl - Software Quality, eXtreme Programming
| |
| mzehle 2006-01-30, 7:58 am |
| Do you know how to connect the data from the cvs with the coverage
analysis data?
I could not find a single tool that offers this functionality... will I
have to do something manually?
| |
| Dariusz Cieslak 2006-02-01, 3:56 am |
| On 2006-01-30, mzehle <mzehle@web.de> wrote:
> Do you know how to connect the data from the cvs with the coverage
> analysis data? I could not find a single tool that offers this
> functionality... will I have to do something manually?
I don't know about such tool, but any programmer could do such thing
(in scripting language in one hour). This is typical operation on two
text files (coverage data from coverage analisys and annotated source
from CVS).
Power of Unix tools comes from simplicity. You can do everything
because many small tools can be combined in one, more sophisticated.
Tools can be connected into automated pipes and do the right job from
make or ant.
PS. I suggest to read "Pragmatic Programmer" by Andrew Hunt and David
Thomas (especialy sections with advices 20 and 21). This is the bible
of many "pragmatic" programmers like me.
--
Darek Cieslak; +48 505-670-010; cieslakd at gazeta.pl
http://cieslakd.webpark.pl - Software Quality, eXtreme Programming
| |
| mzehle 2006-02-02, 7:02 pm |
| Thanks Darek, I think I'll find a solution for that. (unfortunately not
in the "Pragmatic Programmer" :-)
Martin
|
|
|
|
|