From: Jonathan Nieder <jrnieder@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Thomas Rast <trast@student.ethz.ch>
Subject: Re: [PATCH 6/6] t/README: A new section about test coverage
Date: Sat, 24 Jul 2010 18:32:32 -0500 [thread overview]
Message-ID: <20100724233232.GB6374@burratino> (raw)
In-Reply-To: <AANLkTim7v199lMKNEhOALx_38ChIIgvD4oERQJU5SNdv@mail.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
>> Ævar Arnfjörð Bjarmason wrote:
>>> + - Check the test coverage for your tests. See the "Test coverage"
>>> + below.
[...]
> What I was going for here is that you should try to make sure that the
> code you're adding is covered by tests by running the coverage tests.
>
> I.e. if I add a new function "blah" to git-whatever which is
> implemented by the "do_blah" function checking if every line of
> "do_blah" is covered is an excellent indicator of whether that code is
> being exhaustively tested, as opposed to just superficially tested.
>
> In most cases a low test coverage counts is telling about the overall
> quality of the tests.
>
> But, the wording can probably be improved. Do you have a suggestion
> for the above intent compressed into a sentence or two? I can't come
> up with anything right now.
What I meant is that when developing a new feature, I think paying
too much attention to coverage numbers is a very dangerous thing.
It produces two hazards: too many tests and too few tests.
- too many tests because when I write my "do_blah" function
that is about a case no one cares about in practice, to write
artificial tests to exercise would actually be to do harm.
- too few tests because if I focus on testing all the code I
just wrote, then I am very unlikely to include tests for the
cases I did /not/ write code for. Some important cases are
just easy; we should still test them because that will help
if the code is ever refactored later. Some important cases
may be just not implemented yet; test cases for them are
very helpful indeed to readers and future implementers.
In other words, I would rather that when writing tests, authors would
forget about the implementation for a moment and just think about what
a user wants to do.
That said:
The rest of the time, checking test coverage does provide a very good
indication about what features might not be well tested yet. So it is
still a good way to decide where to /start/ writing tests.
Plus it’s great fun to look at. :)
Thanks,
Jonathan
prev parent reply other threads:[~2010-07-24 23:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-24 20:50 [PATCH 0/6] Detailed test coverage reports for Git Ævar Arnfjörð Bjarmason
2010-07-24 20:50 ` [PATCH 1/6] gitignore: Ignore files generated by "make coverage" Ævar Arnfjörð Bjarmason
2010-07-24 20:50 ` [PATCH 2/6] Makefile: Include subdirectories in "make cover" reports Ævar Arnfjörð Bjarmason
2010-07-24 22:37 ` Thomas Rast
2010-07-24 23:28 ` Ævar Arnfjörð Bjarmason
2010-07-24 23:41 ` Jonathan Nieder
2010-07-26 5:44 ` Junio C Hamano
2010-07-24 20:51 ` [PATCH 3/6] Makefile: Split out the untested functions target Ævar Arnfjörð Bjarmason
2010-07-24 23:02 ` Thomas Rast
2010-07-24 23:29 ` Ævar Arnfjörð Bjarmason
2010-07-24 20:51 ` [PATCH 4/6] Makefile: Add coverage-report-cover-db target Ævar Arnfjörð Bjarmason
2010-07-24 23:01 ` Thomas Rast
2010-07-24 23:28 ` Ævar Arnfjörð Bjarmason
2010-07-24 20:51 ` [PATCH 5/6] Makefile: Add coverage-report-cover-db-html target Ævar Arnfjörð Bjarmason
2010-07-24 20:51 ` [PATCH 6/6] t/README: A new section about test coverage Ævar Arnfjörð Bjarmason
2010-07-24 21:25 ` Jonathan Nieder
2010-07-24 21:29 ` Jonathan Nieder
2010-07-24 23:17 ` Ævar Arnfjörð Bjarmason
2010-07-24 23:32 ` Jonathan Nieder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100724233232.GB6374@burratino \
--to=jrnieder@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).