Re: Re: First cut at using CppUnit… Testing Bye class

Hello everybody!

Thanks to Atul who pointed me to CppUnit and provided a sample unit test for Gnutella::Packets::Bye + Makefile!

I just finished a qmake project for CppUnit (built as library), to which our Calitko tester could easily link against, without requiring the developers to additionally install CppUnit. There is already too much (new) stuff that a new Calitko developer needs to install, so bundling CppUnit is I think a good solution.

The attached zipped patch adds the directory Testing under the project root. It contains a directory cppunit (I should maybe rename it to CppUnit) and Gnutella. My original idea was to have all the unit tests in a separate directory tree, namely under Testing. So, the unit is for example ./Gnutella/Packets/Bye.cpp and the unit test is ./Testing/Gnutella/Packets/Bye.cpp. The problem I have now is that the unit test requires the real module to also be linked in the test application and I still haven’t thought of a good way to do that. I now use a very quick hack - instead of including ../Gnutella/Packets/Bye.h I include ../Gnutella/Packets/Bye.cpp and also ../Gnutella/Packets/Packet.cpp.

What do you think about separating the unit test physically? Further ideas?

Regards,

Peter

Attached Files:

Would you like to post a relpy?


This post is a reply to:
Re: First cut at using CppUnit… Testing Bye class
Thanks for the files, Atul! I took a quick look into what you’ve done and it looks quite neat! I also read the CppUnit Cookbook which explains the basics (more...)

No follow-ups yet.