Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing for C++ code - Tools and methodology [closed]

People also ask

What can be used for unit testing in C?

The most scalable way to write unit tests in C is using a unit testing framework, such as: CppUTest. Unity. Google Test.

Does C have unit testing?

A Unit Testing Framework for CCUnit is a lightweight system for writing, administering, and running unit tests in C. It provides C programmers a basic testing functionality with a flexible variety of user interfaces.

Is unit testing a methodology?

Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. This testing methodology is done during the development process by the software developers and sometimes QA staff.

Why do we do unit test what are the tools available for unit tests in C#?

Unit testing helps developers to test their code written whether it meets design & requirements and behaves as expected before delivering to QA testing. This will help to identify problems at early stages of the development even though it can't be replaced with integration testing & performance testing.


Applying unit tests to legacy code was the very reason Working Effectively with Legacy Code was written. Michael Feathers is the author - as mentioned in other answers, he was involved in the creation of both CppUnit and CppUnitLite.

alt text


Google recently released their own library for unit testing C++ apps, called Google Test.

Project on Google Code


Check out an excellent comparison between several available suites. The author of that article later developed UnitTest++.

What I particularly like about it (apart from the fact that it handles exceptions etc. well) is that there is a very limited amount of 'administration' around the test cases and test fixtures definition.


Boost has a Testing library which contains support for unit testing. It might be worth checking out.