[openbeosstorage] CppUnit and Testing, 2nd Try
- From: "Tyler Dauwalder" <tyler@xxxxxxxxxxxxx>
- To: <openbeosstorage@xxxxxxxxxxxxx>
- Date: Sat, 2 Mar 2002 01:49:59 -0800
For some reason, I can't send mail to this list from BeOS and
not have question marks and underscores replaced with garbage...
This version should be more readable.
-Tyler
----------------------------------------------------------------------
I've been playing with CppUnit a bit and think I finally have most
of the bugs worked out. Here's what I have set up at the moment:
/storage_kit/cppunit/ has the CppUnit distribution stuff. I've
gotten it compiling with Jam finally, so that all gets compiled into
an archive cppunit.a.
/storage_kit/test/ has all the test code.
The individual tests for a given class all go in one header file or
a header file and cpp file if you want to break it up (you won't
have to edit the Jamfile if you put it all in the header).
There's a main program in Test.StorageKit.cpp to which you add
a #include for your header and one line to add the test suite
you implement for your class to the list of tests. The test program
gets compiled and then linked into two seperate versions:
Test.StorageKit.R5 gets linked with Be's R5 libraries, and
Test.StorageKit.OpenBeOS gets linked with our libstorage.a
sitting in /storage_kit/source/lib. The output currently looks
something like this:
$ Test.StorageKit.OpenBeOS
------------------------------------------------------------------------------
Tests
------------------------------------------------------------------------------
BNode::RemoveAttr()
- FAILURE ==> node.RemoveAttr("ThisWillFail") == B_OK
BNode::ReadAttr()
+ PASSED
------------------------------------------------------------------------------
Results
------------------------------------------------------------------------------
Failures: 1
Errors: 0
$
Now, it might be nice to be able to run a test on a specified class
only. I think I'll add some command line argument code when I
get the chance to let us do stuff like "Test.StorageKit.OpenBeOS
BNode BStatable" and have just the BNode and BStatable tests
run.
Also, it would be possible to list a detailed summary of all failures
and errors at the end of the test. It doesn't really matter when it's a
short like the example above, but with 20 some classes being tested
all at once, it might be handy.
I also have everything hooked up to Jam so you can just run "jam"
from /storage_kit/ and build cppunit, the tests, and our libstorage
implementation all at once.
Does this sound reasonable to everyone? Any suggestions? If
we're all pretty happy with it, I'll throw it in CVS in the next couple
of days.
-Tyler
- Follow-Ups:
- [openbeosstorage] Re: CppUnit and Testing, 2nd Try
- From: Simon Cusack
Other related posts:
- » [openbeosstorage] CppUnit and Testing, 2nd Try
- » [openbeosstorage] Re: CppUnit and Testing, 2nd Try
- [openbeosstorage] Re: CppUnit and Testing, 2nd Try
- From: Simon Cusack