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 of CppUnit and I like it so much more than QtTestLib!

You are right that we have to think about how to make the integration right. I think the best way (the easiest for most developers) would be to bundle the parts we need from CppUnit into Calitko. The qmake project file calitko.pro should be extended to generate either a Makefile for Calitko, or a Makefile for CalitkoTester, or for both. A post build step for CalitkoTester would be to run the generated executable (have to check how a post build step is declared in qmake). I think it would be wise to have a test suite per package and maybe a separate test app for each of the bigger packages. What do you think?

In some cases we might need to use stubs (see HandshakerTester) in place of the real classes and we might have issues with compilation and linking. We might use the Imports.h and Imports.cpp to import the stubs instead of the real classes if UNIT_TEST is defined. In some places we might have to do some redesigning of existing code in order to facilitate unit testing.

I downloaded cppunit-1.10.2 and sneaked a look at the source… I’d like to try in the weekend to create a qmake project for cppunit, or at least for the core which we would need. I also downloaded QxRunner which is a lib providing a Qt4 based graphical test runner. The guys have written a note that they will publish qmake files in the next days, but I think they mean only project for QxRunner, not CppUnit.

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
First cut at using CppUnit… Testing Bye class
Dear all Here is my first attempt... The source change is just the main function in main.cpp is not compiled... Thru a -DUNIT_TEST define. I am deliberately failing a test so you (more...)

Follow-ups:
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 (more...)