cppunit

How can I measure CppUnit test coverage (on win32 and Unix)?

I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report that tells me on a per-library or per-file basis, how much of the code was exercised. Here's the kicker: this has to run completely unnat...

Recovering from exceptions using CPPUnit

I have been using CPPUnit as a unit testing framework and am now trying to use it in an automated build and package system. However a problem holding me back is that if a crash occurs during the running of the unit tests, e.g. a null pointer dereferencing, it halts the remainder of the automation. Is there any way for CPPUnit to recove...

Comparison of c++ unit test frameworks

I know there are already a few questions regarding recomendations for c++ unit test frameworks, but all the answers did not help as they just recomend one of the frameworks but do not provide any information about a (feature) comparison. I think the most interesting frameworks are CppUnit, Boost and the new Google testing framework. Has...

How to parametrize a test using cppunit

We are using cppunit, i am trying to run the same test using different parameters, running a loop inside the test is not a good option as any failure will abort the test. I have looked at TestDecorator and TestCaller but neither seem to really fit. Code samples would be helpful. Thanks. ...

Visual C++ TDD setup

I haven't worked much with Visual Studio before. I've started a personal project in my spare time and I would like to use test-driven development since it has been a huge benefit to me in my Java development. I started this project quite a while ago, and I used CppUnit. I know there are probably other frameworks that are better, but this...

Unit testing destructors?

Is there any good way to unit test destructors? Like say I have a class like this (contrived) example: class X { private: int *x; public: X() { x = new int; } ~X() { delete x; } int *getX() {return x;} const int *getX() const {return x;} }; Is there any good way to unit test th...

cppunit linking error

When compiling my test suite againts cppunit, I get the following linking error: error LNK2019: unresolved external symbol "public: virtual __thiscall CppUnit::TextTestRunner::~TextTestRunner(void)" (??1TextTestRunner@CppUnit@@UAE@XZ) referenced in function _wmain I don't understand this problem as the provided examples link fine. I...

Equivalent of CppUnit protectors for boost::test ?

I've used both CppUnit and boost::test for C++ unittesting. Generally I prefer boost::test, mainly because the auto-test macros minimise the effort to setup tests. But there's one thing I really miss from CppUnit: the ability to register your own "protectors", instances of which automatically wrap all the run tests. (Technically, you ...

"Echo" device for Unit Testing

I'm currently writing up some CPPunit tests for a program that tests a hardware communication port (yes, I'm writing unit tests for a tester app ;-) ). One of the classes I'm testing is basically a wrapper around the device's file descriptor; I make read() and write() calls on the file descriptor. Is there a device file/driver on Linux...

Cppunit; trying to compile class to test

I am quite new to both C++ and Cppunit. I am trying to compile a little cppunit test. However, I do not succeed. qwerty@qwerty:~/chessgame/src$ g++ -Wall CoordinateTest.cpp ftest.cpp -lcppunit -o test /tmp/cc1vJJqz.o: In function CoordinateTest::coordinateTest()': CoordinateTest.cpp:(.text+0xbb): undefined reference to Coordinate::Coord...

Using CppUnit for memory leak detection

Is anyone aware of extensions to CppUnit that can be used to make assertions on a test by test basis concerning memory leaks. i.e. CPPUNIT_ASSERT_NO_LEAKS()? Essentially, I want to be able to fail specific tests when the execution of the test results in leaked memory. ...

Visual Stuido Can not find CPPUNIT debugging database

Hi All, I am using Visual Studio 2008 with CPPUNIT. I already compiled CPPUNIT and add CPPUNIT path to Include and Library path. Currently, I can compile my program with CPPUNIT library. However, the linker generates the following warning. Warning 2 warning LNK4099: PDB 'vc90.pdb' was not found with 'C:\Program Files\cppunit\cppunit-1...

Linking in test libraries with CppUnit

I'm setting up a bunch of unit tests using CppUnit but am having the problem that none of the tests are being run. The project is divided up into several small libraries and I planned on dividing the unit test classes up the same way and then linking them all into a single test program. The problem is, then the test classes are in thei...

How to run CPPUnit unit tests

I have written few c++ Unit tests using CPPUnit But I do not understand how to run those. Is there any tool like Nunit-gui? Currently I have written and packed tests in a DLL. When i google i found this http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html But i am not able to understand how does it get tests from a DLL...

vtable problem with cppunit and xcode project

...

overloading operator<< for use with ostream

I am using CPPUnit to test a class in my program. This class (SCriterionVal) is somewhat unique because it has conversion operators for a lot of types (it's essentially a dynamic type value class). When I compile test cases that test it using CPPUNIT_ASSERT_EQUAL(), I get compilation errors about "operator<< is ambiguous" from one of t...

CppUnit leakage

Hi all, running my regression tests with valgrind I have this kind of report: ==20341== 256 bytes in 1 blocks are indirectly lost in loss record 915 of 919 ==20341== at 0x4A0661C: operator new(unsigned long) (vg_replace_malloc.c:...

how to turn off a unit test in CPPUnit

I (finally) have my app being unit tested with CPPUnit and I have CruiseControl.NET running the tests and displaying the test output. I have several tests that always fail, however, so CruiseControl always marks the build as failed. Is there any way I can "turn off" or "skip" or "ignore" these always-failing tests? I'd rather not just...

how to use cpp unit

Is there a good book or online site discussing the use of the CppUnit, for a beginner? ...

CruiseControl discrepancy between mail and project page

I have a problem with CruiseControl where it sends the correct number of passed unit tests in the mail notifications, but when I go to the project page it shows "No Tests Run". I checked the XML log file and it has all the unit tests reported. I tried looking through CC's XSL and JSP files but didn't get any indication from there. What s...