UnitTest

From Wikipedia, the free encyclopedia

Contents

[edit] UnitTest

The C/C++ Source Code Unit Test Framework!

UnitTest is a test framework designed for unit testing C/C++ code on the Microsoft Windows platform. UnitTest has a tiny footprint, the code is very clean. It's written in C++ and can be downloaded freely. The Author Rajinder Yadav, clearly states.

"You are free to use, share and make modification to the source code as long as you mention the original source (devmentor.org) and the author."

Rajinder does a good job of describing the UnitTest Framework architecture with notes and a UML diagram. He also provides good documentation that will get you up and running in a few minutes!

Getting Started Unit Testing

Read the "UnitTest Guide" to get started, it is a quick introduction on how to code a Unit Test class, but the doc starts off by saying how to avoid this process by using the "utgen.exe" tools to generate the Unit Test class on the fly!

The UnitTest Framework comes with three unit test observers:

  • Console Logger
  • Stream Logger
  • UnitTestMonitor (MFC GUI Window Logger)

[edit] UTGen

The UnitTest framework comes with a neat little command line utility that you will love to use. It helps to quickly generate the Unit Test class source and header files with the test case methods that are provided through the argument.No more having to cut and paste from a template source file.

A typical session might look like this:

utgen.exe -n MyUnitTest -t Load Save Connect Open

Here are the following switches that are available
   /s <subject class>
   /n <class name>
   /o <output directory>
   /a <author name>
   /c <copyright>
   /t <test case> ...

The subject class is the name of the class you want unit test.

[edit] See also

[edit] References

[edit] External links