[PATCH 0/3] Unit test framework for Wayland

U. Artie Eoff ullysses.a.eoff at intel.com
Wed Feb 29 11:36:27 PST 2012


From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>

Unit testing is a very powerful method to find problems early on in the
development cycle. It allows us to test individual parts for correctness and
logic.  It also serves as a form of regression testing.

Ideally, we would like to write test cases for all functions and methods so that
whenever a changed causes a fault, it can be quickly identified and fixed.

If you're more curious on unit testing in general and why it's beneficial, there
is a well written document at <http://en.wikipedia.org/wiki/Unit_testing>.

One of the goals of this unit test framework is to provide an easy method that
allows developers and testers to write unit tests.  The 'Check' unit testing
framework for C (<http://check.sourceforge.net>) appeared to be one of the best,
readily available open source frameworks for C that provides a simple to use
interface.

This patch-set is the start of such a unit test framework for the Wayland
project that exploits the 'Check' unit testing framework.  I've also
added a few initial, simple test cases to test the util array data structures
and functions.  Those tests can serve as a starting point/example for the rest
of the project contributors to start writing their own tests.  Also, the 'Check'
documentation gives a nice tutorial and examples on some more advanced ways of
writing unit tests.  Invoking the unit test suite is simple, too: 'make check'.

Currently the project has a 'unit test debt', if you will, and with a little
persistence, dedication, and discipline I think all of us project contributors
can eliminate this test coverage debt.  If we all commit to writing at least one
unit test each day [or two days] which covers some previously untested code
path, we should be able to bring the unit test coverage up to an acceptable and
useful level and make this a success.  Eventually, we would like to apply
these unit testing methods to weston, as well.

In general, developers write unit tests since they have more intimate knowledge
of the code they are writing and how it's supposed to function.  However, I'm
suggesting that our QA team get involved too, initially, to help bring down some
of the unit test coverage 'debt'.

Note that this unit testing is not meant to replace feature, functionality,
and/or integration testing.  Our QA team is quickly ramping up on defining those
tests and associated methods for testing those areas.

I really hope that the rest of you, as developers and contributors, are willing
to adopt this framework into Wayland and understand the benefits it brings.
It'll certainly help strengthen our confidence that we are creating and
delivering useful, high quality professional software solutions to the
community.

Regards,

U. Artie Eoff
Software Engineer - QA and Validation Lead
Visualization - Intel Open Source Technology Center


U. Artie Eoff (3):
  Add dependency checking for the check module.
  Add initial unit tests and unit test framework.
  Add copyright to test files

 Makefile.am                |    2 +-
 configure.ac               |    7 ++-
 tests/Makefile.am          |    8 +++
 tests/check-wayland-util.c |  129 ++++++++++++++++++++++++++++++++++++++++++++
 tests/wayland-check.h      |   61 +++++++++++++++++++++
 5 files changed, 205 insertions(+), 2 deletions(-)
 create mode 100644 tests/Makefile.am
 create mode 100644 tests/check-wayland-util.c
 create mode 100644 tests/wayland-check.h

-- 
1.7.7.6



More information about the wayland-devel mailing list