Re: Re: Re: Re: Unit Testing is vital

OK guys! Here is a patch (committed in revno 73) that generates a calitko library and links the unit tests against this library. Furthermore, the calitko app is linked only if all tests pass! The tests are run as a pre build step of the app and thus the actual linking is performed only if all tests passed!

I was thinking about creating a directory 3rdParty in the project root and put all libraries (currently zlib and cppunit) there. What about the suggestion not to use the Testing subtree but rather put tests and stubs in a corresponding sub-package for each package (the suggestion in one of my previous posts)?

Regards,

Peter

Peter Dimov wrote:

Hi Atul,

Thanks a lot for your comments and suggestions! I’ve been thinking about the library thing, although in another context, and also totally agree with you about including the .cpp files in the tests. Your suggestion to build calitko as a library seems to me like a good idea. I should also be little effort to do so. I’ll update the .pro files accordingly and provide a patch soon.

I was also rethinking the usefulness of the Testing sub-tree. I think it’s a nice example for DRY (Don’t Repeat Yourself) – duplicating the package trees under Testing. I was thinking instead to have a Tests sub-directory in each package directory. This way tests stay with the code they test but are separated from them ;-). For example, BitTorrent packets are implemented in Protocols/BitTorrent/Packets and their tests in Protocols/BitTorrent/Packets/Tests. Similarly we might put stubs for the actual classes in a Stubs sub-directory (e.g. Protocols/BitTorrent/Stubs) and reuse them when testing other packages. Actually Tests and Stubs would be just special kinds of sub-packages meaning also the corresponding namespaces should be used. I think using the namespaces is important to make the generated documentation clearer.

What do you and the others think?

Best regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: Re: Re: Unit Testing is vital
Hi Atul, Thanks a lot for your comments and suggestions! I’ve been thinking about the library thing, although in another context, and also totally agree with you about including the .cpp (more...)

Follow-ups:
Re: Re: Re: Re: Re: Unit Testing is vital
With revision 75 the dependencies between tester and app are fixed to make sure the unit tests are always up to date and executed prior to building the app. Added (more...)