Question: In CPP unit we run unit test as part of build as part of post build setup. We will be running multiple tests as part of this. In case if any test case fails post build should not stop, it should go ahead and run all the test cases and should report summary how many test cases passed and failed. how can we achieve this.

Thanks!

Answer: 
His question is specific enough. You need a test runner. Encapsulate each test in its own behavior and class. The test project is contained separately from the tested code. Afterwards just configure your XMLOutputter. You can find an excellent example of how to do this in the linux website. <http://www.yolinux.com/TUTORIALS/CppUnit.html>

We use this way to compile our test projects for our main projects and observe if everything is ok. Now it all becomes the work of maintaining your test code.
I would just write your tests this way. Instead of using the CPPUNIT\_ASSERT macros or whatever you would write them in regular C++ with some way of logging errors.

You could use a macro for this too of course. Something like:

`LOGASSERT( some_expression )`

could be defined to execute some\_expression and to log the expression together with **FILE** and **LINE** if it fails, and you can also log exceptions of course, as well as ones that are not thrown, simply by writing them in your tests (with macros if you want to log the expression that caused them with **FILE** and **LINE**).

If you are writing macros I would advise you to limit the content of your macro to calling an inline function with extra parameters.