Go to the FreeLists Home Page Home Signup Help Login
 



[openbeosstorage] || [Date Prev] [03-2002 Date Index] [Date Next] || [Thread Prev] [03-2002 Thread Index] [Thread Next]

[openbeosstorage] CppUnit and Testing

  • From: "Tyler Dauwalder" <tyler@xxxxxxxxxxxxx>
  • To: OpenBeOSStorage@xxxxxxxxxxxxx
  • Date: Sat, 02 Mar 2002 01:45:56 PST (-0800)
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=5Fkit/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=5Fkit/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=5Fkit/source/lib. The output currently looks
something like this:

$ Test.StorageKit.OpenBeOS
------------------------------------------------------------------------------
Tests
------------------------------------------------------------------------------
BNode::RemoveAttr()
  - FAILURE =3D=3D> node.RemoveAttr("ThisWillFail") =3D=3D B=5FOK

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=5Fkit/ and build cppunit, the tests, and our libstorage
implementation all at once.

Does this sound reasonable to everyone=3F Any suggestions=3F If 
we're all pretty happy with it, I'll throw it in CVS in the next couple
of days.

-Tyler







[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.