views:

1126

answers:

3

How effective is the CXX test framework, given that you are writing unit test cases around the code that you have written. Any bug in the code might as well get translated into a bug in the unit test code as well? Isn't it something like two negatives make a positive?

Also, the time and effort spent on CXX is at least equal to if not more than the coding effort.

Need your thoughts on this since I'm not in favor of this framework being used in my project and am looking for strong points to oppose it.

On the other hand, if you think it's beneficial, please do enlighten me :).

+1  A: 

CXX is not very active, and writing unit test generally involves a lot of efforts. But when the first refactoring comes in, you're very grateful of the spent effort.

I've used Boost.Test & CPPUNIT. I would prefer a little bit Boost.Test, but yes, you have to write your own projects, files etc.

If you know a tool to generate your skeleton from your code, I'm all ears. :)

I would suggest that you give a try to Boost.Test and CPPUNIT. If you think there are better it will give you good rounds to oppose CXXUNIT as you will propose alternatives.

Edouard A.
CxxTest does not need to be active. Unlike CppUnit, it is complete and simple to use. It's only awkwardness comes from the no <*stream> dependency policy.
Luc Hermitte
I'm sorry to disagree, but it's important to use maintained software. What happens when it becomes incompatible with your compiler? When there is a bug? You do it yourself?
Edouard A.
In other cases I may have agreed. CxxTest doesn't use advanced C++ templates, nor require RTTI, nor require exceptions, nor most of the standard library in order to be compatible with most older compilers, and future ones. And if I must patch the tool, I'll will, it is very simple framework.
Luc Hermitte
In a professional context it's very problematic to know you're working on an unsupported product. I know I wouldn't allow that in my company. Having the source code doesn't mean being able to support it.
Edouard A.
+1  A: 

I am using cxxtest. Regressive testing is an expensive task that we only use to validate our software libraries - which provide a platform independent layer for our apps. This is to ensure that all changes will not affect the stability of the code since so many apps and projects and dependent on them.

We couple cxxtest with coverage analysis to ensure that test coverage is sufficient and also with CruiseControl to automate it.

But we do not do this for apps. Too much effort.

Building a test app is just as difficult as writing the whole library itself. I agree that you will need to work out whether it is worth your while.

I think Joel has something to say about this too: http://www.joelonsoftware.com/items/2009/01/31.html

sep
+2  A: 

Google offers a fantastic C++ testing framework that I have used... I never used any other C++ testing framework, and had limited experience with Junit, and I was able to pick this up very quickly, as the documentation is good. It's important to use a good testing framework, because testing is too important to give up on because of frustration with the framework. Here is a link:

http://code.google.com/p/googletest/

Hope this helps!

Tom