Cput – is the unit test framework that allows create and run tests for C++ projects. MS Visual Studio add-in makes easier to add new tests, debug and run existing. It is currently supported x86 C++ projects for MS VS 2005 and 2008.

Why to use it?
The idea of unit test for development is to debug a new functional for every small part with total control. But to not waste a hell of time writing a test environment its creation has to be automated and a test framework should be able to run one or more tests instantly and with easy selection. That was the goal of creating the cput.

How to use it?
The cput add-in is made similar to the CLR test framework so after setup installation you would be able to create new tests by Tests\New C++ Test… command and run them by using the Test Runner Window (Tests\Test Runner Window). Also the framework manual is placed in the application folder during setup.
menu.jpg

How to access private and protected members?
There are two macros ut_private and ut_protected that will be private and protected for origin projects and public for test ones (where the _UT preprocessor definition is defined).

How to use the test application output?
The test framework prints the results of a test run in the application output and creates an xml report file after a unit test run. The test application command line parameters, input and output formats are fully described in CPUT common runtime project description.doc that goes with source code(see project cputcrt).

How to customize unit test asserts?
The framework assert set is defined in utassert.h file. You can create there new macros that throwing CUtException. Also CUtException can be used to manage test run engine behavior.


testrunner.jpg
Test runner window

newtests.jpg
New tests dialog

Changes Log

Build 1.3.31 changes:
1. Include Assert.h in a main-cpp file for console applications is now wrapped by _UT ifdef
2. Output and Intermediate directories are now set to $(ProjectDir)$(ConfigurationName) for new
unit test projects (That should remove problem with old obj-files during linking).
3. cputaddinX.dll registration changed to allow usage add-in for all users.
4. Setup project modified to clean registry during uninstallation for x64 platforms.
5. Cput2005_9 solution added that allow build setup of the cput2005 add-in by using VS9. That
resolves compatibility issue that occurs during installation on Windows 7.

Last edited Nov 29, 2009 at 11:27 AM by generalov_sergey, version 12