Re: Gtk+ unit tests (brainstorming)
- From: Tristan Van Berkom <tvb gnome org>
- To: Havoc Pennington <hp redhat com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: Gtk+ unit tests (brainstorming)
- Date: Thu, 26 Oct 2006 10:55:09 -0400
Havoc Pennington wrote:
Michael Urman wrote:
On 10/25/06, Tim Janik <timj imendio com> wrote:
- GLib based test programs should never produce a "CRITICAL **:" or
"WARNING **:" message and succeed.
It would be good not to make it impossible to test WARNINGs and
CRITICALs. After all, error cases are often the least tested part of
an application, so it's important to make sure the base library
detects and handles the error cases correctly.
Testing those is like testing segfault handling, i.e. just nuts. The
behavior is undefined once they print. (Well, for critical anyway.
g_warning seems to be less consistently used)
On the other hand - its happened to me several times to have gtk+
crash when setting up properties on an object genericly from glade,
where a simple g_return_if_fail() guard on that public api would have
saved me the trouble of a segfault (sometime one property has no
meaning if another one hasnt been setup yet - in which case a
g_return_if_fail() guard would be appropriate).
Whether or not its really really relevent, I think that the critical
warnings from a function that wasnt fed the correct arguments,
or are invalid because of the current object state - are part of
the contract of the api, and for whatever thats worth, maybe
worth testing for.
Ummm, while I'm here - I'd also like to say that - (I'm not about to
dig up the quote from the original email but) - I think that there
is some value to reporting all the tests that fail - even after one
of the tests has failed, based on the same principals that you'd
want your compiler to tell you everything that went wrong in its
parse (not just the first error), maybe not all spewed out to the console
by default - but having the whole test results in a log file can
save valuable developer time in some situations.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]